Usefulness of subclassing builtin number types

Mike Meyer mwm at mired.org
Mon Dec 16 19:12:24 EST 2002


Martin v. Löwis <martin at v.loewis.de> writes:
> > Couldn't the builtin types's methods use 
> >     self.__class__(...)
> > to construct new objects?  
> As I've said in <atiev5$sfe$07$1 at news.t-online.com>: No, unless 
> someone resolves all semantic issues with such an approach.

Those looking for insight into such issues might want to take a look
at Eiffel. It's INTEGER class defines all the operators as returning
an object of the class of the target.

The references are "Eiffel: the Language" and "Object Oriented
Software Construction", both by Bertrand Meyer. The latter should
actually be read by anyone building object-oriented systems.

        <mike
-- 
Mike Meyer <mwm at mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.



More information about the Python-list mailing list