non-factory functions?

Dale Strickland-Clark dale at riverhall.NOTHANKS.co.uk
Wed Oct 24 14:55:11 EDT 2001


mike.rudnick at mobilian.com (Mike Rudnick) wrote:

>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?
>
>TIA,
>  Mike

My understanding is a factory function is one that returns an object.

class spam:
    pass

def getspam():
    return spam()

That is a very basic example. 'getspam' is a factory function for
'spam' objects.
--
Dale Strickland-Clark
Riverhall Systems Ltd



More information about the Python-list mailing list