On Sat, Nov 23, 2013 at 10:00 AM, Bruce Leban <bruce@leapyear.org> wrote:
On Nov 22, 2013 8:06 PM, "Steven D'Aprano" <steve@pearwood.info> wrote:
def __main__(argv): ...
is a cleaner (but less flexible) idiom that the current if __name__ business, and simpler for people to learn.
If I had a time machine I would either do the __main__ function or alternatively:
if __main__: ....
but alas I can't time travel and changing it will *not* be simpler to learn because people will be seeing both the old idiom and the new idiom for a long time. While it's interesting to discuss from the standpoint of what's the best design, it's just not worth changing, IMHO.
That was why I said it'd be for the long long term... If we ever do anything, I like this simple __main__ bool idea best. Decorators are too much unnecessary complexity for the task.