Guido van Rossum wrote: > On 6/9/06, Nicko van Someren <[EMAIL PROTECTED]> wrote: [...] > > The language doesn't have zero-dimensional arrays, although it doesn't > prevent users from defining them. but why would one want to index a > zero-dimensional array, since it has no dimensions? It should be > written as x, not x[].
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. Thus "a[()] = 3" will set the value of a 0-D array to 3 and "a[()]" will extract the current, scalar value of a, for instance if you need a hashable object. 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. [...] -tim _______________________________________________ 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