class objects in dictionaries

P.J.W.S. Vrijlandt P.J.W.S.VRIJLANDT at INT.azg.nl
Sat Feb 5 11:41:11 EST 2000


Would this be what you mean?

class storage:
   from string import *
mystorage = storage()

Now you can do:
>>>mystorage.join
<built-in function join>



> To:            python-list at python.org

> Hi all,
> 
> I would like to put all my class definitions in a dictionary
> __objects__ in main global namespace. I know I can do it by
> putting the class objects into module called __objects__ and
> import this module, but that way classes would have different
> global namespace and I need them to have the same global
> namespace as the main script.
> 
> I need to do something like:
> 
> from class_objects import * to __objects__
> 
> Is there any way in Python how to do this?
> 
> Thank you for help.
> 
> Martin
 
Met vriendelijke groet,

Patrick Vrijlandt




More information about the Python-list mailing list