Does Python provide "Struct" data structure?

MonkeeSage MonkeeSage at gmail.com
Fri Sep 22 15:09:13 EDT 2006


Hi Daniel,

To avoid problems you could vendor the ipython file you require, but an
easier solution may just be to implement your own version of the class
(it's extreemly easy):

class struct():
  def __init__(self, *args, **kwargs):
    for k, v in kwargs.items():
      setattr(self, k, v)

mystruct = struct(echo = 1,
                  verb = 'Verbose',
                  filedir = 'C:/temp')

print mystruct.filedir

Regards,
Jordan




More information about the Python-list mailing list