utility functions within a class?

John Salerno johnjsal at NOSPAMgmail.com
Mon May 8 15:18:50 EDT 2006


Dennis Lee Bieber wrote:
> tOn Mon, 08 May 2006 14:04:34 GMT, John Salerno
> <johnjsal at NOSPAMgmail.com> declaimed the following in comp.lang.python:
> 
>> I tried the underscore method, but I was still able to call it as a 
>> regular instance method in the interpreter. Is that what's supposed to 
>> happen?
> 
> 	Single underscores are a convention/signal to the programmer that
> "this method/attribute" is considered "private" and should only be used
> by other methods within the class that defined it. The language does no
> enforcement of usage. For example:

I see. But isn't there something about a single leading underscore that 
doesn't import when you use from X import *? Or am I thinking of 
something else? Is that also the double underscore?



More information about the Python-list mailing list