> Inheriting from "int" is not too helpful, because you can't assign
> to the value of the base class.  "self=1" won't do what you want.

It's useful if you remember that you can set the default value by
overwriting __new__.

>>> class int1(int):
...     def __new__(cls, value=1):
...         return super(int1, cls).__new__(cls, value)
...
>>> int1()
1
>>> int1(1)
1
>>> int1(2)
2
>>> int1(0)
0

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to