Why is there no natural syntax for accessing attributes with names not being valid identifiers?

Ethan Furman ethan at stoneleaf.us
Thu Dec 5 00:09:52 CET 2013


On 12/04/2013 02:13 PM, Piotr Dobrogost wrote:
> On Wednesday, December 4, 2013 10:41:49 PM UTC+1, Neil Cerutti wrote:
>> On 2013-12-04, Piotr Dobrogost <> wrote:
>>
>>> Right. If there's already a way to have attributes with these
>>> "non-standard" names (which is a good thing)
>>
>> At best its a neutral thing. You can use dict for the same
>> purpose with very little effort and no(?) loss of efficiency.
>
> As much as many people in this topic would like to put equal
>  sign between attributes and dictionary's keys they are not the
>  same thing. AFAIK descriptor protocol works only with attributes,
>  right?

Correct.  It is looking very unlikely that you are going to get enough support for this change.  Perhaps you should look 
at different ways of spelling your identifiers?  Why can't you use an underscore instead of a hyphen?

--
~Ethan~



More information about the Python-list mailing list