Tim Hochberg wrote:

> In Numpy, a 0-D array [for example, array(5)] is almost, but not quite, 
> equivalent to  scalar [for example, 5]. The difference is that the 
> former is mutable.

Hmmm, I hadn't considered that. I suppose this is
something that arises from NumPy's "view" semantics
of indexing and slicing.

> Whether that makes x[] desirable I won't venture an opinion. I don't see 
> a lot of use of 0-D arrays in practice.

Actually, I *have* just thought of a use for it:

   def outer():
     x = array(0)
     def inner():
       x[] = 42

Bingo - write access to outer scopes!

Okay, I'm +0 on this now. But for that use, we'd need
a more convenient way of creating one than importing
NumPy and using array().

--
Greg
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to