[Numpy-discussion] Numarray 0.5
verveer at embl-heidelberg.de
Wed May 7 02:17:12 CDT 2003
> > I am not sure if this is a bug, or intended behaviour, but the possibilty
> > to compare an array type object to 'Any' would be very useful for me.
> 'Any' grew up from the C-API, rather than down from the Python design,
> so it's not very well thought out. Right now, it is a placeholder used
> to mark arrays with undefined types and to indicate "no type constraint"
> in C API calls. In normal contexts, you can't make an array of type
> 'Any'. I think there are two reasonable behaviors for comparisons with
> 'Any', both used in C. The first behavior is literal comparison; here
> comparison to Any would generally return "not equal". The second
> behavior is wild-card matching; here, comparison to Any would generally
> return "equal". Which makes sense to you? How do you want to use
I use 'Any' right now in C functions to indicate 'no type constraint'. You
could use both literal comparison and wild-card matching behaviour for that,
if you want to do this in Python, I think. But maybe one should not do such a
thing in Python by comparison to 'Any' at all.
Literal comparison is what I generally expect from Python objects, so anything
else may just be confusing (at least to me). However, the name 'Any' does
suggest the wild-card matching behaviour.
Is there specific reason why you exposed 'Any' in python? Maybe it would be
better not to expose such a type object since it seems to be a 'special
case'. I am starting to think that my use for it at the Python level is not
appropiate. For instance, I could easily use 'None' instead, and I think I
will do that in the future.
You mentioned that 'Any' is really a C-API thing. Unless somebody has a good
use for it I would now actually say that it maybe should not be exposed at
the Python API level at all...
Dr. Peter J. Verveer
Cell Biology and Cell Biophysics Programme
Tel. : +49 6221 387245
Fax : +49 6221 387242
Email: Peter.Verveer at embl-heidelberg.de
More information about the Numpy-discussion