Odd behavior regarding a list
Rhodri James
rhodri at wildebst.demon.co.uk
Thu Mar 26 19:38:35 EDT 2009
On Thu, 26 Mar 2009 17:01:40 -0000, Edd Barrett <vext01 at gmail.com> wrote:
> On Mar 26, 4:21 pm, Steven D'Aprano <st... at REMOVE-THIS-
> cybersource.com.au> wrote:
>> A few more comments, based on your code.
>>
>> > def __classdef_integer(self):
>>
>> Double-underscore name mangling is often more trouble than it is worth.
>> Unless you really need it, not just think you will need it, it is
>> generally considered poor style.
>
> It was an attempt at encapsulation. I didn't want my parser to call
> internals willy-nilly. Is there a better way?
The usual convention is to use a single leading underscore to mean
"this is private, please don't call/use/alter this." Then don't
call/use/alter it from outside the class. You don't really need
anything stronger than convention unless for some odd reason you
don't trust yourself.
--
Rhodri James *-* Wildebeeste Herder to the Masses
More information about the Python-list
mailing list