[Tutor] refactoring book and function size

Magnus Lycka magnus@thinkware.se
Wed, 18 Sep 2002 19:25:17 +0200


At 09:26 2002-09-18 -0700, Jeff Shannon wrote:
>In Python, the distinction between public and private methods is blurred,
>but still exists to some extent -- if nothing else, method names beginning
>with a single underscore are recognized by convention as being private,
>and method names beginning with two underscores are mangled with the
>classname to "enforce" privacy.  I find it very helpful to be able to
>designate some methods as being "for internal use only", and some methods
>as "external interface".

I use the naming conventions of no leading underscore for public, one
leading underscore for *protected* and double underscores for private.
I use the words public, protected and private in the sense of C++, i.e.
public methods are available to all, protected methods are available to
sub-classes, and private methods are only available inside the defining
class.

I know others do this as well. On the other hand, it's rumoured that
Stroustrup himself felt that private, protected and public was one
protection category too many...


--=20
Magnus Lyck=E5, Thinkware AB
=C4lvans v=E4g 99, SE-907 50 UME=C5
tel: 070-582 80 65, fax: 070-612 80 65
http://www.thinkware.se/  mailto:magnus@thinkware.se