[Types-sig] Type Inference II

Laurence Tratt tratt@dcs.kcl.ac.uk
Mon, 20 Dec 1999 10:18:43 GMT


In message <385AE827.42ECB891@maxtal.com.au>
          skaller <skaller@maxtal.com.au> wrote:

> I note python currently supports privacy by name mangling, but really,
> this is a hack: for Python 2, a more sophisticated architecture would be
> better.

Nnngg. I'm not keen on Python ever gaining privacy (the __ name mangling is
nasty, I agree). It just doesn't really seem in the spirit of things; I
always tend to think of the Larry Wall quote "Perl would rather you kept out
of its living room because you weren't invited, not because it has a
shotgun".

In my recent projects, I denote "private" (there's no distinction between
private, protected etc as there is in, say, Java) by just preceeding names
with a "_". I've actually found that highly effective, and it makes it
obvious that "self._method()" and so on are private calls. This approach
also tends to make modules fairly "from module import *" safe.

The only argument I can imagine for privacy is that "from module import *"
tends to import module names etc as well which can make it confusing; but
when we use that feature we deserve everything we get <wink>.


Laurie
-- 
http://eh.org/~laurie/comp/python/