Python Forum
How can I make this as computationally efficient as possible?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How can I make this as computationally efficient as possible?
#2
You can pass sa_data and ia_lines as parameters to get_num and checkWin.
Python checks first the local variables and if the variable is no there checks the global space. It's good to be local.

You can use lxml to parse the document and make the code more readable. I don't know how efficient will be.

import lxml

with open('Text.txt', 'r') as fin:
    tree = lxml.etree.parse(fin)

    ti_reelNum = 0
    for tag in tree.iterfind(".//*[@name]":
        print(tag.attrib['name']) # just for test
        # your code here
I think scipy can handle in much more efficient way such data structure as sa_data but I never used it so can't help here.
These nested for loops... Undecided
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply


Messages In This Thread
RE: How can I make this as computationally efficient as possible? - by wavic - Apr-15-2018, 07:27 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  BS4 - Is There A More Efficient Way Of Doing This? digitalmatic7 4 6,132 Nov-28-2017, 11:33 AM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020