[Python-projects] Type inference not working?
Adrien Di Mascio
Adrien.DiMascio at logilab.fr
Thu Jan 24 08:00:57 CET 2008
Hi Marteen,
[Maarten ter Huurne]
> ===
>
> The way I want to use it is by having a factory method like this:
> ===
> @staticmethod
> def create(data):
> instance = SomeClass()
> instance.__setSomething(data)
> return instance
> ===
>
> I want to have several ways of instantiating the same class and doing it
> all using different constructor arguments would be messy.
As a side note, I would use classmethod for such cases to make
subclasses able to use your alternate constructors.
--
Adrien Di Mascio LOGILAB, Paris (France).
Formations Python,Zope,Debian,Calcul http://www.logilab.fr/formations
Développement logiciel sur mesure: http://www.logilab.fr/services
Informatique scientifique: http://www.logilab.fr/science
Python in Python: http://codespeak.net/pypy/dist/pypy/doc/index.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.logilab.org/pipermail/python-projects/attachments/20080124/4e9b5903/attachment.pgp
More information about the Python-Projects
mailing list