Translating some Java to Python
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Mon May 21 09:44:57 EDT 2007
En Mon, 21 May 2007 09:26:19 -0300, Unknown <unknown at unknown.invalid>
escribió:
> One example that comes to mind is a class that is a proxy for a database
> class, say Person.
> The Person.Load(id) method doesn't use any instance or class data, it
> instantiates a Person and populates it from the database.
> It is clearly a part of the class's interface so for that I use a
> @staticmethod.
This is called a "factory method" and is usually implemented as a
classmethod but a staticmethod is often OK.
> *That* Pythonic I'm already ;-)
Good!
--
Gabriel Genellina
More information about the Python-list
mailing list