Stephen Hansen wrote:
Or just leave it as a top level function where it was perfectly happy to live :)

Yes. This is probably the sanest solution anyway, because probably having many such functions to use, packing them into smth like package.utils anyway is a good idea. I'm trying mainly to learn and test-drive such solutions, not that I would be keen to use them excessively in production code.

    This obviously means no other method can call it like
    self.print_internal_date(), because self would get passed as first
    argument, yes?


It doesn't have to be. It could be a class method-- @classmethod does that, makes it receive 'cls' the actual class as the first argument. Or a @staticmethod, in which case it has no first-argument at all.

Ahh now I get it. Thanks! So that's the use for @staticmethod (I was wondering if there was any).

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to