Use of factory pattern in Python?
Fredrik Lundh
fredrik at pythonware.com
Thu Dec 7 03:31:26 EST 2006
Nathan Harmston wrote:
> so I was thinking of having a factory class to return the individual
> objects for each row......ie
>
> class Factory():
> # if passed a gene return a gene object
> # if passed an intron return an intron object
> # if passed an exom return an exon object
>
> Is this a good way of doing this, or is there a better way to do this
> in Python
in python, that's spelled:
def factory(...):
# if passed a gene return a gene object
# if passed an intron return an intron object
# if passed an exom return an exon object
</F>
More information about the Python-list
mailing list