Guido van Rossum wrote: > On 6/9/06, Nicko van Someren <nicko at nicko.org> 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
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4