dictionary and __getattr__

Harald Kirsch kirschh at lionbioscience.com
Thu Sep 6 05:54:39 EDT 2001


Wouldn't it be nice if this would work:

  d = {'x': 1}
  print d.x

i.e. every entry in a dictionary is also an attribute of the
dictionary itself. 

Is there a class wrapper for that somewhere available?

  Harald Kirsch

-- 
----------------+------------------------------------------------------
Harald Kirsch   | kirschh at lionbioscience.com | "How old is the epsilon?"
LION bioscience | +49 6221 4038 172          |        -- Paul Erdös
       *** Please do not send me copies of your posts. ***



More information about the Python-list mailing list