Which is Faster in Python and Why?
jc = {}; m = []
x = [ [1,2,3,4,5,6,7,8,9],[..],...] # upwards of 1 entries
def mcountb():
for item in x:
b = item[:]; b.sort(); bc = 0
for bitem in b: bc += int(bitem)
try: m = jc[bc]
except: m = []
if m.count
Great observations... Changing for lists to tuples would make sorting
unnecessary...
--
http://mail.python.org/mailman/listinfo/python-list
Well, I could, but I was looking for answers from persons more
experienced in the ways of Python then myself
--
http://mail.python.org/mailman/listinfo/python-list
Tim, Are you saying that:
not (b in m)
is faster than:
b not in m
--
http://mail.python.org/mailman/listinfo/python-list
Execellent, Kent. Thank you... and everyone too! I've learned much!
--
http://mail.python.org/mailman/listinfo/python-list
Thank you, Peter! Please understand, I was attempting to get more info
on the WHY x is faster than y... from those with more experience.
Timer cannot give me that info.
--
http://mail.python.org/mailman/listinfo/python-list