On September 10, 2002 01:14 pm, Tim Roberts wrote:
> >> As a stylistic note: you should not generally use
> >> double underscores as a lead-
> >> in for your own variable names.  Those are reserved
> >> for Python itself.
> >
> >I always thought double underscores was a method for
> >making attributes and methods 'private' (actually
> >'mangled' would be the right word since there isn't
> >the 'security' that C++ provides).
> >
> >Can someone confirm either theory for us?
>
> *One* underscore marks an attribute or method as private.  Double
> underscored names are reserved for Python.

No.  Single _ is a convention that means "Hey other programmer, this is
private, don't use it!" The Python interpreter does nothing to enforce this.
Double __ is a language feature that means "Hey Python, this is private. Hide
it!"  It is enforced, sort of.

Tavis



-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to