[Django]-Reflection in python

12👍

What I really need is a way to just instantiate the object.

That’s what the globals()['Foo']() part does.

And it works for me:

>>> class Foo:
...   def __init__(self): print "Created a Foo!"
...
>>> globals()['Foo']()
Created a Foo!
<__main__.Foo instance at 0x02A33350>
>>>

Leave a comment