[ python-Bugs-878908 ] suspect documentation of
operator.isNumberType
SourceForge.net
noreply at sourceforge.net
Sat Jan 17 23:49:49 EST 2004
Bugs item #878908, was opened at 2004-01-17 12:05
Message generated for change (Comment added) made by tim_one
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=878908&group_id=5470
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Colin J. Williams (cjwhrh)
Assigned to: Nobody/Anonymous (nobody)
Summary: suspect documentation of operator.isNumberType
Initial Comment:
The docs appear to draw a distinction between
containers and simple classes. I had expected the
NumberType to include IntType, LongType, FloatType,
ComplexType and, perhaps BoolType, but no others.
The attached script shows that it includes the
BoolType, but it also includes the numarray.array.
On the other hand, it does not include array.array.
This is to suggest that either the docs be clarified or
a probably bug be reported.
----------------------------------------------------------------------
>Comment By: Tim Peters (tim_one)
Date: 2004-01-17 23:49
Message:
Logged In: YES
user_id=31435
Sorry, I don't understand your point. bool is a subtype of int,
so of course it "acts like a number". numarray isn't part of
the Python core, so the core Python docs have nothing to
say about it. It seems reasonable to me for a numarray.array
to say it's numeric, because it supports numeric operations
(for example, you can add 1 to a numeric.array, and it
broadcasts the scalar; you cannot add 1 to an array.array --
there's nothing number-like about array.arrays).
More formally, numarray.array fills in the type object's
tp_as_number slot at the C level, while array.array does not.
That's the only clue Python has as to whether a type
is "number-like", and is (almost) the only thing the
implementation of isNumberType looks at.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=878908&group_id=5470
More information about the Python-bugs-list
mailing list