Examples of metaclasses as factory functions/classes?

Stuart Hungerford stuart.hungerford at anu.edu.au
Thu Oct 17 02:10:10 CEST 2002


Hi all,

Has anyone done any work in using Python's newish metaclasses implementation
for creating factory functions or classes ("factory" as per the various GoF
patterns)?

Is there any advantage to handling factories this way over the usual idioms
using
keyword parameters in an __init__, or a separate function or class that
creates
instances?

Also - does having __new__ influence how these creational patterns can be
implemented compared to using __init__ alone?


I-promised-timbot-no-more-design-by-contract-questions-ly-yours,

Stu





More information about the Python-list mailing list