On Aug 29, 2019, at 04:58, Steven D'Aprano <[email protected]> wrote:
>
> - quote marks are also used for function calls, but only a limited
> subset of function calls (those which take a single string literal
> argument).
This is a disingenuous argument.
When you read spam.eggs, of course you know that that means to call the
__getattr__('eggs') method on spam. But do you actually read it as a special
method calling syntax that’s restricted to taking a single string that must be
an identifier as an argument, or do you read it as accessing the eggs member?
Of course you read it as member access, not as a special restricted calling
syntax (except in rare cases—e.g., you’re debugging a
__getattribute__), because to do otherwise would be willfully obtuse to do so,
and would actively impede your understanding of the code. And the same goes for
lots of other cases, like [1:7].
And the same goes for regex"a.*b" or 1.23f as well. Of course you’ll know that
under the covers that means something like calling
__whatever_registry__['regex'] with the argument "a.*b", but you’re going to
think of it as a regex object or a float object, not as a special restricted
calling syntax, unless you want to actively impede your understanding of the
code.
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/JGDXZSDXGHFAHSPIS5MCKDDWJJ2WVOV2/
Code of Conduct: http://python.org/psf/codeofconduct/