[Python-bugs-list] [ python-Feature Requests-510394 ] Add base classes for numeric types

noreply@sourceforge.net noreply@sourceforge.net
Fri, 08 Feb 2002 07:14:39 -0800


Feature Requests item #510394, was opened at 2002-01-29 14:31
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=355470&aid=510394&group_id=5470

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Raymond Hettinger (rhettinger)
Assigned to: Nobody/Anonymous (nobody)
Summary: Add base classes for numeric types

Initial Comment:
Create a class hierarchy for numeric types (similar to 
the structure for exceptions) so that the following 
work:

issubclass(int,numeric)==1
issubclass(int,real)==1
issubclass(complex,real)==0
isinstance( 3.14, real ) == 1


----------------------------------------------------------------------

Comment By: Gregory Smith (gregsmith)
Date: 2002-02-08 07:14

Message:
Logged In: YES 
user_id=292741

I don't think it's entirely clear whether ints are
a subclass of floats or vice versa, or whether complex
are a subclass of complex, or vice versa, but I'd be
interested to hear reasons. B is a subclass of A makes
sense when there are things you can do to the 'B' as
if it were an 'A'. Clearly, ints (but not longs) are
numerically a subSET of float and float is a subset
of complex; I don't see how that relates to subclassing.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=355470&aid=510394&group_id=5470