TheFlyingDutchman a écrit : > On Sep 8, 9:52 am, Bruno Desthuilliers > <[EMAIL PROTECTED]> wrote: > >>TheFlyingDutchman a écrit : (snip) >>>class TestOutcomes: >>> PASSED = 0 >>> FAILED = 1 >>> ABORTED = 2 >> >>> def ToString(outcome): >>> if outcome == TestOutcomes.PASSED: >>> return "Passed" >>> elif outcome == TestOutcomes.FAILED : >>> return "Failed" >>> else: >>> return "Aborted" >> >>> ToString = staticmethod(ToString) >> (snip) >>Technically correct, but totally unpythonic. > > > Speaking of unpythonic, I would call > > ToString = staticmethod(ToString) > > A Perlific syntax.
Nope, just a good ole HOF. But nowadays, it's usually written this way: @staticmethod def some_static_method(): pass > >>May I suggest some reading >>?http://dirtsimple.org/2004/12/python-is-not-java.html > > Well the Foo.Foo complaint is bogus: > > from Foo import Foo > Yes. And properties are bogus - just use getters and setters. Seriously, writing Java in Python is definitively on the masochist side. But if you like pain... -- http://mail.python.org/mailman/listinfo/python-list