Ridley5 opened this issue on Jul 26, 2010 · 1724 posts
adp001 posted Thu, 12 August 2010 at 8:48 AM
Quote - In a completely unrelated note, I just realized that I can use list comprehensions. I've been avoiding generator expressions since they would not work in Poser 6, which uses Python 2.2. But list comprehensions were introduced in 2.0. Awesome!
Err... carry on.
Maybe it makes sense to have different versions of some functions?
Kind of this:
if PYTHON_VERSION >= 2.4 :
# Fast and memory efficent
def topological_order(children):
seen = set()
result = num.zeros( ... )
....
if not v in seen :
seen.add(v)
...
else:
# remarkable slower
def topological_order(children):
seen = {}
result = []
....