This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: suspect documentation of operator.isNumberType
Type: Stage:
Components: None Versions:
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: Nosy List: cjwhrh, tim.peters
Priority: normal Keywords:

Created on 2004-01-17 17:05 by cjwhrh, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
testIsNumberType.py cjwhrh, 2004-01-17 17:05 An illustrative Python script.
Messages (2)
msg19724 - (view) Author: Colin J. Williams (cjwhrh) Date: 2004-01-17 17:05
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.
msg19725 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2004-01-18 04:49
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.
History
Date User Action Args
2022-04-11 14:56:02adminsetgithub: 39834
2004-01-17 17:05:11cjwhrhcreate