setattr and getattr, when to use?

2008-08-22 Thread maestro
Why are these functions there? Is it somehow more idiomatic to use than to do obj.field ? Is there something you can with them that you can't by obj.field reference? -- http://mail.python.org/mailman/listinfo/python-list

if len(str(a)) == len(str(r)) and isMult(a, r): faster if isMult is slow?

2008-08-11 Thread maestro
If isMult is slow then: if len(str(a)) == len(str(r)) and isMult(a, r): trues.append((a, r)) will be much faster than: if isMult(a, r) and len(str(a)) == len(str(r)): trues.append((a, r)) right? seems obvious but there is no magic going on that wouldn't make thi

while var, but var ==16 != true

2008-07-13 Thread maestro
why does this work? "while p" = "while p != 0" ? 1 is True and 0 is false in python but other numbers have no boolean value so why doesnt it abort. >>> p=16 >>> p 16 >>> while p: print p p -= 1 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 >>> i can also do: >>> k=[] >>> while k:

Why is there no GUI-tools like this for Windows?

2008-07-12 Thread maestro
http://www.youtube.com/watch?v=PXpwC1o5AcI I have done some GUI-programming for windows with Python but the Tkinter interface sucked and while it is the only one I tried I got the impression they are all the same. It's amazing how retarded a lot of the stuff programmers do is. Watcing that video,