Really stupid question regarding PEP 252 and type/class unification
Marcin 'Qrczak' Kowalczyk
qrczak at knm.org.pl
Thu Aug 23 15:11:35 EDT 2001
Thu, 23 Aug 2001 17:59:04 +0100, Jacob Kaplan-Moss <jacobkm at dont.spam.me.cats.ucsc.edu> pisze:
> I think I see what Russel is getting at here... the point is, myInt
> is an instance of class MyInt when it is first created, but what
> if I want to change the value of myInt without modifying the class?
int is immutable, so I expect the int part of MyInt to be immutable.
If you want a mutable int, don't inherit but compose/delegate (I'm
not familiar with the terminology).
You can't replace the base object when inheriting from regular classes
either. For regular classes there is even no base object (the same
__dict__ is used).
--
__("< Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/
\__/
^^ SYGNATURA ZASTĘPCZA
QRCZAK
More information about the Python-list
mailing list