[Python-ideas] Factory functions (was: RE: time.wallclock() or other similar stuff)
mal at egenix.com
Wed Nov 3 10:13:49 CET 2010
Antoine Pitrou wrote:
> On Wed, 3 Nov 2010 13:26:27 +0800
> Kristján Valur Jónsson
> <kristjan at ccpgames.com> wrote:
>> And why are there factory functions in threading.py and not classes?
> I'm not sure, but it looks like a poor man's way of discouraging
You usually use factory functions if you only define an API that
can then be implemented in many ways.
With a class hierarchy you are always bound to one implementation
and moving from Python to C or providing different specifically
optimized implementations can become cumbersome.
ElementTree is another example that uses factory functions.
Professional Python Services directly from the Source (#1, Nov 03 2010)
>>> Python/Zope Consulting and Support ... http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
::: Try our new mxODBC.Connect Python Database Interface for free ! ::::
eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
Registered at Amtsgericht Duesseldorf: HRB 46611
More information about the Python-ideas