On 07/29/2010 09:12 PM, wheres pythonmonks wrote:
How do I build an "int1" type that has a default value of 1?
You mean something like: >>> x = int() >>> x 0 >>> def myint(value=1): ... return int(value) ... >>> myint() 1 >>>
That's ugly on so many levels.. Anyway, basic types (and almost everything else) in Python are classes. You can always subclass them to do whatever you like
[Hopefully no speed penalty.] I am thinking about applications with collections.defaultdict. What if I want to make a defaultdict of defaultdicts of lists? [I guess my Perl background is showing -- I miss auto-vivification.]
Ah, python is no perl. Then again, perl is no python either. ----- Random pseudo-Confucius quote Have fun, Nick -- http://mail.python.org/mailman/listinfo/python-list