super confused !
Michal Wallace
sabren at manifestation.com
Thu Feb 28 22:52:42 EST 2002
On Fri, 1 Mar 2002, robin and jim wrote:
> >>> class Int_c(Int_a):
> ... def __init__(self):
> ... super(Int_c, self).__init__(99)
> ...
> >>> Int_c()
> 0
> >>> class Int_d(Int_a):
> ... def __init__(self):
> ... Int_a.__init__(self, 99)
> ...
> >>> Int_d()
> 0
>
> Why are Int_c() and Int_d() zero (the default for int()) rather than 99?
>
> How can I make them 99?
use __new__ instead of __init__... Guido explains it in
"Unifying types and classes in Python 2.2":
http://www.python.org/2.2/descrintro.html#__new__
Cheers,
- Michal http://www.sabren.net/ sabren at manifestation.com
------------------------------------------------------------
Give your ideas the perfect home: http://www.cornerhost.com/
cvs - weblogs - php - linux shell - perl/python/cgi - java
------------------------------------------------------------
More information about the Python-list
mailing list