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
How about
print ["%04d" % x for x in xrange(1)]
--
http://mail.python.org/mailman/listinfo/python-list
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