Double underscores -- ugly?

benhoyt benhoyt at gmail.com
Wed Feb 20 03:49:59 EST 2008


> > Then again, what's stopping us just using a single leading underscore?
> > Nobody calls their own private methods _init or _add
>
> You must be looking at different code from the rest of us. A single
> leading underscore on the name *is* the convention for "this attribute
> is not part of the external interface", which is about as "private" as
> Python normally gets.

Yeah, I understand that. I meant -- and I could be wrong -- that I
haven't seen people creating a method called "init" with a single
leading underscore. It's too similar to "__init__", so they would use
some other name.

In other words, defining _init to mean what __init__ now means
probably wouldn't cause name conflicts.

-Ben



More information about the Python-list mailing list