3 ms·
Mostly true 'cept for pythons built in pasta makers: http://www.python.org/dev/peps/pep-0318/ http://www.python.org/dev/peps/pep-0318/
by user0398 15y ago
Mostly true 'cept for pythons built in pasta makers:
http://www.python.org/dev/peps/pep-0318/ http://www.python.org/dev/peps/pep-0318/
- Luyt 15y agoYeah, that's fun ;-) I wish there was a if main: ... # do some processing instead of having to write: if __name__ == "__main__": ... # do some processing That'd make DHH happy, too ;-)
- anthonyb 15y agoI find that the best way to fix this is to write your program as a library, then the part that you're supposed to run as a script which imports and runs it. No __underscore__magic__ required.
- olefoo 15y agoDecorators can be misused, but they can also succinctly express an aspect of the program that is repeated many times in different contexts. My own rule is that a decorator should do one thing, and that thing should be described by it's name. Being able to look at a method that has the @has_permission decorator on it and know that it is getting checked for against a package wide permission model is more clear than having boilerplate to check permissions on every method that needs that check. Any language construct can be misused. And people can hide stupid things in decorators and name them in misleading ways. That doesn't mean that it's the fault of the syntax.