wishlist Python3K: subclass ints

Neil Schemenauer nascheme at enme.ucalgary.ca
Thu Jun 8 13:44:38 EDT 2000


Pete Shinners <pete at visionart.com> wrote:
[subclassing types]
>i think this is really important also. i'd like to see all
>python objects given the same 'value'
>
>a small sampling of reasons to make all types (yes, even ints)
>real class types that can be subclassed
>
> - "Debug Int" class. want to make an int that prints to
>   a log every time it gets assigned?

Your mental model of Python is flawed I believe.  It is
impossible to "assign" to an int.  Variables are bindings not
storage locations.  ints are immutable.

> - Just the fact that i could subclass any "C" object would
>   make it worth the while.

This should be fixed when the type/class distinction is fixed.

    Neil

-- 
"If you're a great programmer, you make all the routines depend on each
other, so little mistakes can really hurt you." -- Bill Gates, ca. 1985.



More information about the Python-list mailing list