Commit 652116e1 authored by Michele Maris's avatar Michele Maris
Browse files

u

parent be6ad557
Loading
Loading
Loading
Loading

src/yapsut/struct.py

0 → 100644
+21 −0
Original line number Diff line number Diff line
class struct :
   """ class used to emulate a C struct, members are seen as attributes
   self.keys() returns the list of elements
   """
   def keys(self) :
      return self.__dict__.keys()
   def __setitem__(self,this,that) :
      self.__dict__[this]=that
   def __getitem__(self,this) :
      return self.__dict__[this]
   def __repr__(self) :
      out=[]
      for k in self.keys() :
            out['('+k+':'+str(self[k])+')']
      return '('+(','.join(out))+')'
   def __init__(self) :
      return
      if od is None :
            return
      for k in od.keys() :
            self.__dict__[k] = od[k]