too many self

Alex Martelli aleaxit at yahoo.com
Thu Sep 16 23:23:29 CEST 2004


aurora <aurora00 at gmail.com> wrote:
   ...
> Of couse I think this syntax the best:
> 
>    if max < list[index]:
>       max = list[index]:

Just to ensure that the best approach,
    self.max = max(self.max, self.list[index])
isn't available any more, _and_ you can't use the list built-in name any
more either?  What a scoop!


> This remind me of those awful Hungarian notation.

Explicit scope denotation, and Hungarian notation (which prefixes names
with type-connected prefix strings), have essentially nothing to do with
each other, of course.  Making classes implicit scopes (like, say, C++,
but differently from, say, Modula-3) is simply a horrid mess, where you
can't use bare names safely without carefully studying all the internals
of all your ancestor classes... and if any such ancestor ever adds a
private name it can break every subclass which _did_ use bare names.  A
bad idea even in a language where the compiler can find out statically
where every name comes from (because human readers can't), just as bad
as "from foo import *" in Python or "using namespace foo" in C++ except
that you can't avoid it by just eschewing one misdesigned construct.

In a language where even the compiler _cannot_ tell statically which
bare names come from where (except for functions' locals), criticizing
the language design choice of _not_ making classes into implcit scopes
doesn't even _verge_ on the ridiculous -- it plunges right deep into it.


Alex



More information about the Python-list mailing list