Nov. 23, 2013
1:51 a.m.
On Fri, 22 Nov 2013 17:45:22 -0800 Sean McQuillan <mcquillan.sean@gmail.com> wrote:
Adding a mainfunction decorator was mentioned in the other thread, seemed interesting so I coded up a simple example to see how it works.
https://github.com/objcode/mainfunction/blob/master/mainfunction/mainfunctio...
From the README:
@mainfunction def main(): print "Hello, World."
vs:
if __name__ == '__main__': print "Hello, World."
After playing with it briefly, I'm not sure it's a clear spelling win as decorators are a fairly advanced topic to a new programmer. If statements are one of the first programming constructs a new programmer learns - and they don't leave a "magic taste".
Indeed, I think the current idiom is much better. Regards Antoine.