I feel like this paragraph in the PEP goes a little bit too far, but I
understand its good intention.

The first difference is in meaning to the reader. A function call says
> "arbitrary function call potentially with side-effects". An indexing
> operation says "lookup", typically to point at a subset or specific
> sub-aspect of an entity (as in the case of typing notation). This
> fundamental difference means that, while we cannot prevent abuse,
> implementors should be aware that the introduction of keyword arguments to
> alter the behavior of the lookup may violate this intrinsic meaning.


Smuggling in a generic function calls in square brackets is undesirable
(but obviously not preventable at a language level).  However, I feel like
keywords might very often "alter the behavior."

For example, imagine we have a distributed array within an engine that is
intended to be "eventually consistent."  I would find code like this, in
some hypothetical library, to be clear and useful, and not to violate the
spirit of indexing.

snapshot1 = remote_array[300:310, 50:60, 30:35, source=worker1]
> snapshot2 = remote_array[300:310, 50:60, 30:35, source=worker2]
> if not (snapshot1 == snapshot2).all():
>     print("Wait a bit for worker synchronization...")



-- 
The dead increasingly dominate and strangle both the living and the
not-yet born.  Vampiric capital and undead corporate persons abuse
the lives and control the thoughts of homo faber. Ideas, once born,
become abortifacients against new conceptions.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/4QJMFGUFPGZ3ARDI2I2765COMRI3UD7I/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to