I find the proposed syntax worse than the existing square brackets. The way the NumPy does a repr of an array is a good model of clarity, and it's correct current Python (except for larger arrays where visual ellipses are used).


On Oct 20, 2016 12:01 AM, "Greg Ewing" <greg.ewing@canterbury.ac.nz> wrote:
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
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/