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/070977.html below:

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

[Python-Dev] New syntax for 'dynamic' attribute access [Python-Dev] New syntax for 'dynamic' attribute accessRaymond Hettinger python at rcn.com
Mon Feb 12 18:52:42 CET 2007
[Raymond Hettinger]
>> Rather than munge existing syntaxes, an altogether new one would be
>> more clear:
>>
>>    self->name = self.metadata->name

[Ben North]
> One thing which comes to mind about this one is that, for C/C++
> programmers, the difference between
>
>   obj.member            and             obj->member
>
> is the interpretation of the thing on the *left* of the dot or arrow,
> whereas the PEP is discussing a new interpretation of the thing on the
> *right* of the dot.

Try not to get hung-up on meanings from other languages.
Any simple syntax will have associations in other languages.
It is more important that we don't create a syntax which already
has strong associations in Python (i.e. curly braces, dots, and square 
brackets).
Those syntaxes would make the language harder to mentally parse.

I would like to give the -> syntax a chance as is it simple
and it is provides a nice visual distinction between closely
related concepts:

    a.name              --    getattr(a, 'name')
    a->name           --    getattr(a, name)


Raymond 
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