On Sat, 9 Jan 2016 03:16 am, Chris Angelico wrote:

> On Sat, Jan 9, 2016 at 3:07 AM, Steven D'Aprano <st...@pearwood.info>
> wrote:
>> If you absolutely insist that you must must must continue to use a double
>> underscore name, you could also try this:
>>
>> py> __a = 1
>> py> class Test:
>> ...     def method(self):
>> ...             x = eval("__a")
>> ...             print(x)
>> ...
>> py> Test().method()
>> 1
>>
>>
>> But don't do that.
> 
> Seriously? You consider that less bad than globals()["__a"]?

No. That's why I said "don't do that" rather than "you should do this" :-)


> But all of this is craziness to support craziness. It's not asking
> which inmate should run the asylum - it's asking which of my multiple
> personalities should be elected fourteen-year-old queen.

Loretta, surely.




-- 
Steven

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to