Re: Newbie Q: Class Privacy (or lack of)

2006-07-24 Thread Kevin Watters
See: http://redhanded.hobix.com/inspect/monkeypytching.html Shouldn't be done unless you have a really cool reason for doing so. -- http://mail.python.org/mailman/listinfo/python-list

Re: Number combinations

2006-07-19 Thread Kevin Watters
How about print ["%04d" % x for x in xrange(1)] -- http://mail.python.org/mailman/listinfo/python-list

Re: No need to close file?

2006-07-18 Thread Kevin Watters
There's always the new 'with' statement in Python 2.5. So instead of > f = open('foo', 'r') > try: >for line in f: > print line > finally: >f.close() > ...you do: with open('foo','r') as f: for line in f: print line It's at least a little bit cleaner, and it will clos