[Python-ideas] Python multi-dimensional array constructor
Greg Ewing
greg.ewing at canterbury.ac.nz
Thu Oct 20 03:00:12 EDT 2016
Matt Gilson wrote:
> I think that
> it was mentioned that it might be possible for a user to _register_ a
> callable that would then be used when this syntax was envoked -- But
> having a global setting like that leads to contention.
I think for that to fly it would have to be a per-module
thing. Then each module using the syntax would be able
to choose the meaning of it.
A simple way to do this would be for the compiler to
translate it into something like
__array__([[[ ... ]]])
and then you would just define __array__ appropriately,
e.g.
from numpy import array as __array__
Personally I'm not very enthusiastic about the whole
thing, though. I don't find the new syntax to be much of
an improvement, if any. Certainly nowhere near enough
to be worth adding syntax.
--
Greg
More information about the Python-ideas
mailing list