Double underscores -- ugly?

Hyuga hyugaricdeau at gmail.com
Tue Feb 19 12:13:40 EST 2008


On Feb 19, 4:01 am, Duncan Booth <duncan.bo... at invalid.invalid> wrote:
> Berwyn <berh... at gmail.com> wrote:
> >> Is it just me that thinks "__init__" is rather ugly? Not to mention
> >> "if __name__ == '__main__': ..."?
>
> > That ugliness has long been my biggest bugbear with python, too.  The
> > __name__ == '__main__' thing is something I always have to look up,
> > every time I use it, too ... awkward.
>
> > I'd settle for:
>
> >     hidden def init(self):          # which could be extended to work
> > for everything "hidden x=3"
> >     ...
>
> > And for __name__ == '__main__' how about:
>
> >     if sys.main():
> >         ...
>
> Or even:
>
>   @hidden
>   def init(self): ...
>
> @main
> def mymainfunc():
>    ...
>

I'd much rather type a few underscores than have to constantly use
decorators.  I don't see what's so ugly about __init__.  To me it just
looks like it's underscored, though maybe that comes from having
worked with a lot of wikis.  But I really don't find it an
encumbrance, and the fact that it requires no special handling from
the parser is just part of the beautiful simplicity of Python.

Hyuga



More information about the Python-list mailing list