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
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