Issue222790

classification
Title: Subclassing type(1) and doing math
Type: Severity: normal
Components: Core Versions:
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: bckfnn
Priority: low Keywords:

Created on 2000-11-18.18:51:49 by bckfnn, last changed 2000-11-18.21:49:14 by bckfnn.

Messages
msg17 (view) Author: Finn Bock (bckfnn) Date: 2000-11-18.18:51:49
A ClassCastException is thrown by the script below.

-------------- FILE: test118.py --------------
IntegerType = type(1)
class SpecialInt (IntegerType):
    def __init__(self, n):  IntegerType.__init__(self, n)
    def double(self):  return self*2

si = SpecialInt(12)
print si
print si + 1
print si + si
print 3 + si
-------------- END --------------
msg18 (view) Author: Finn Bock (bckfnn) Date: 2000-11-18.21:49:14
Fixed. A subclass of builtin types are possible, but no API exists that the subclass can use/override to gain control of the builtin type.
History
Date User Action Args
2000-11-18 18:51:49bckfnncreate