Re: class-private names and the Zen of Python

2013-10-09 Thread Marco Buttu
On 10/09/2013 01:00 AM, Oscar Benjamin wrote: On Tue, 08 Oct 2013 12:13:48 +0200, Marco Buttu wrote: Another question is: where is the place in which this transformation occurs? Is it at the parser level, before the dictionary attribute is gave as argument to the metaclass? I

Re: class-private names and the Zen of Python

2013-10-09 Thread Charles Hixson
On 10/08/2013 06:24 AM, Steven D'Aprano wrote: On Tue, 08 Oct 2013 12:13:48 +0200, Marco Buttu wrote: In the following case: class Foo: ... _Foo__a = 100 ... __a = 33 ... Foo._Foo__a 33 I think this behavior, for a user who does not know the convention, could be a surprise.

class-private names and the Zen of Python

2013-10-08 Thread Marco Buttu
In the following case: class Foo: ... _Foo__a = 100 ... __a = 33 ... Foo._Foo__a 33 I think this behavior, for a user who does not know the convention, could be a surprise. Should be raising an exception (in order to inform the user the transformation of the name __a have been

Re: class-private names and the Zen of Python

2013-10-08 Thread Terry Reedy
On 10/8/2013 6:13 AM, Marco Buttu wrote: In the following case: class Foo: ... _Foo__a = 100 ... __a = 33 ... Foo._Foo__a 33 I think this behavior, for a user who does not know the convention, could be a surprise. No one qualified to use such names would do such a thing , so

Re: class-private names and the Zen of Python

2013-10-08 Thread Marco Buttu
On 10/08/2013 12:36 PM, Terry Reedy wrote: On 10/8/2013 6:13 AM, Marco Buttu wrote: In the following case: class Foo: ... _Foo__a = 100 ... __a = 33 ... Foo._Foo__a 33 I think this behavior, for a user who does not know the convention, could be a surprise. No one qualified to

Re: class-private names and the Zen of Python

2013-10-08 Thread Ned Batchelder
On 10/8/13 6:13 AM, Marco Buttu wrote: In the following case: class Foo: ... _Foo__a = 100 ... __a = 33 ... Foo._Foo__a 33 I think this behavior, for a user who does not know the convention, could be a surprise. Should be raising an exception (in order to inform the user the

Re: class-private names and the Zen of Python

2013-10-08 Thread Marco Buttu
On 10/08/2013 01:07 PM, Ned Batchelder wrote: On 10/8/13 6:13 AM, Marco Buttu wrote: class Foo: ... _Foo__a = 100 ... __a = 33 ... Foo._Foo__a 33 ... You also get a problem if you do this: class Foo: ... a = 100 ... a = 33 ... Foo.a 33 But

Re: class-private names and the Zen of Python

2013-10-08 Thread Steven D'Aprano
On Tue, 08 Oct 2013 12:13:48 +0200, Marco Buttu wrote: In the following case: class Foo: ... _Foo__a = 100 ... __a = 33 ... Foo._Foo__a 33 I think this behavior, for a user who does not know the convention, could be a surprise. Yes, you are correct. It surprised me, and

Re: class-private names and the Zen of Python

2013-10-08 Thread Ned Batchelder
On 10/8/13 7:15 AM, Marco Buttu wrote: Also, as Terry mentions, no one has ever assigned the two names you show, Sincerely, I can not now if someone has assigned (or will assegne) in such way... If you explain more about what you are building, and where this crops up as a problem, we can

Re: class-private names and the Zen of Python

2013-10-08 Thread Oscar Benjamin
On Oct 8, 2013 2:26 PM, Steven Dapos;Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Tue, 08 Oct 2013 12:13:48 +0200, Marco Buttu wrote: Another question is: where is the place in which this transformation occurs? Is it at the parser level, before the dictionary attribute is gave