non-factory functions?
Richard Brodie
R.Brodie at rl.ac.uk
Wed Oct 24 14:51:55 EDT 2001
"Mike Rudnick" <mike.rudnick at mobilian.com> wrote in message
news:3d4e9cba.0110240911.409a66a at posting.google.com...
> I'm new to Python but have a good C/C++ background. I'm having
> difficulty finding out what Python "factory" functions are. Are all
> Python functions "factory" functions?
The usual usage is that a factory function is one that returns
a class object. It may select between available classes with the
same interface:
pseudocode example:
def getGraphicsToolkit():
if hasHardwareAcceleration():
return AcceleratedToolkit()
else
return SimpleToolkit()
toolkit = getGraphicsToolkit()
toolkit.drawCircle(3)
More information about the Python-list
mailing list