On Sat, 9 Jan 2016 03:16 am, Chris Angelico wrote:
> On Sat, Jan 9, 2016 at 3:07 AM, Steven D'Aprano
> 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):
On Sat, Jan 9, 2016 at 3:07 AM, Steven D'Aprano 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)
On Fri, 8 Jan 2016 03:14 am, Joseph Fox-Rabinovitz wrote:
> Hi,
>
> I have a module attribute whose name starts with a pair of underscores.
Don't do that.
The way to flag a module-level variable as private is with a single leading
underscore. Double-leading underscores are intended for use in c
Joseph Fox-Rabinovitz wrote:
> Hi,
>
> I have a module attribute whose name starts with a pair of underscores. I
> am apparently unable to access it directly in a class method (within the
> same module, but that is not relevant as far as I can tell). The following
> bit of code illustrates the si
> On Thu, Jan 7, 2016 at 11:14 AM, Joseph Fox-Rabinovitz
> wrote:
>
> Hi,
>
> I have a module attribute whose name starts with a pair of underscores. I am
> apparently unable to access it directly in a class method (within the same
> module, but that is not relevant as far as I can tell). The f
Hi,
I have a module attribute whose name starts with a pair of underscores. I
am apparently unable to access it directly in a class method (within the
same module, but that is not relevant as far as I can tell). The following
bit of code illustrates the situation:
__a = 3
class B:
def __init_