I am trying to set class definition for dictionary element that every time by getting dict element new object should appear.
Example:
types = {}
types[first_type] = FirstType()
types[second_type] = SecondType()
And by setting types[first_type] I have to get new FirstType():
some_var = new types[first_type] # this is illegal statement.
How can I achieve this in Python?