ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> numpy-discussion
numpy-discussion
Re: [Numpy-discussion] A case for rank-0 arrays
by Travis Oliphant other posts by this author
Feb 23 2006 9:08PM messages near this date
Re: [Numpy-discussion] A case for rank-0 arrays | Re: [Numpy-discussion] A case for rank-0 arrays
Sasha wrote:

> On 2/23/06, Francesc Altet <faltet@[...].com> wrote:
>   
> 
> >It's a bit late, but I want to support your proposal (most of it).
> >    
> >
> 
> You are not late -- you are the first to reply! When you say "most of
> it," is there anything in particular that you don't like?
>   
> 
Usually nobody has a strong opinion on these issues until they encounter 
something they don't like.  I think many are still trying to understand 
what a rank-0 array is.


> >>>type(array(2)*2)
> >>>        
> >>>
> <type 'int32scalar'>
> 
> I believe it should result in a rank-0 array instead.
>   
> 
Can you be more precise about when rank-0 array should be returned and 
when scalars should be?

> I've recently wrote ndarray round function and that code illustrates
> the problem of implicite scalar conversion:
>   
> 
I think we will have issues no matter what because rank-0 arrays and 
scalars have always been with us.  We just need to nail down some rules 
for when they will show up and live by them.

Right now the rule is basically:

rank-0 arrays become array-scalars all the time.

The exceptions are

rank0.copy()
rank0.view()
array(5)
scalar.__array__()
one_el.shape=()

If you can come up with a clear set of rules for when rank-0 arrays 
should show up and when scalars should show up, then we will understand 
better what you want to do.

-Travis



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@[...].net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion
Thread:
Sasha
Francesc Altet
Francesc Altet
Colin J. Williams
Travis Oliphant
Sasha
Francesc Altet
Sasha
Travis Oliphant
Sasha
Francesc Altet

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved