A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2007-February/070955.html below:

[Python-Dev] New syntax for 'dynamic' attribute access

[Python-Dev] New syntax for 'dynamic' attribute accessGeorg Brandl g.brandl at gmx.net
Mon Feb 12 08:58:17 CET 2007
Collin Winter schrieb:
> I like the general idea, but the syntax looks like dirt on my monitor.
> The period is too easy to lose visually and without it, there's
> nothing to distinguish this from a function call. Also, like Anthony
> Baxter said, someone coming across this for the first time will think
> it's a syntax error, allusions to MATLAB and assembly indirection
> syntax not withstanding.
> 
> Ignoring the syntax, I'm -1 on the 2-argument form, especially since
> it can only be used in an expression context; getattr() can be kept
> around for this.
> 
> I'm +0 on the idea, -1 on the means.

-1 here too. I fear that this gets too indistinguishable from normal
calling syntax, leading to confusion.

(Of course, one could propose other syntax, such as obj->(attr) or whatnot,
but I doubt an ideal and Pythonic syntax can be found here...)

To me, dynamic attribute access is something "special", and it justifies
a different way of doing it, namely getattr and setattr.

For the speed argument -- there were quite a few proposals to take builtins as
constants under certain conditions, in which case getattr() usage could be
optimized just as well as new syntax.

Georg

More information about the Python-Dev mailing list

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