Public & Private

Erik Max Francis max at alcyone.com
Sat Dec 14 20:04:44 EST 2002


Kevin Ethridge wrote:

> Is the development path of Python ever going to stop pussy-footing
> around
> and just use Private/Public for methods and attributes.

The double-underscore name mangling can be used for this.  I wasn't
aware anyone was pussy-footing; I've always thought it has been very
clear that the Python community in general has no interest in adding
explicit access control (beyond the double-underscore mangling trick as
a tip of the hat to conventional practice anyway).

> Also, why pass self
> to everything? If it is always going to be passed why not let the
> interpreter do the job, it would make the code look much cleaner.

Explicit is better than implicit.  Moreover, since Python can have both
bound and unbound methods, whether or not the self parameter is there
really can make a difference.  Having a totally transparent self
parameter would throw a monkey wrench into things.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ Laughter is the only genuine form of applause.
\__/ Camden Benares
    CAGE / http://www.alcyone.com/pyos/cage/
 A cellular automaton simulation system in Python.



More information about the Python-list mailing list