Re: Smart factory class

2008-01-23 Thread Gabriel Genellina
En Thu, 24 Jan 2008 05:11:19 -0200, kramer31 <[EMAIL PROTECTED]> escribió: > Can anyone tell me if there is a way in python that I can implement a > factory function which takes as input a string ClassName and returns > an object of type ClassName? def InstanceFactory(classname): cls = glo

Re: Smart factory class

2008-01-23 Thread Arnaud Delobelle
On Jan 24, 7:11 am, kramer31 <[EMAIL PROTECTED]> wrote: > Can anyone tell me if there is a way in python that I can implement a > factory function which takes as input a string ClassName and returns > an object of type ClassName? >>> def mkobj(classname, ns=globals()): return ns[classname]() ... >

Smart factory class

2008-01-23 Thread kramer31
Can anyone tell me if there is a way in python that I can implement a factory function which takes as input a string ClassName and returns an object of type ClassName? -- http://mail.python.org/mailman/listinfo/python-list