Insertin **keywords into a class

C. Porter Bassett porter at et.byu.edu
Tue Mar 20 13:53:00 EST 2001


cCan you please tell me why the following code snippet doesn't update the
value of radius?


class myClass:
   def __init__(self, *arguments, **keywords):
      self.radius = 0.0
      for kw in keywords.keys():
         print kw, ":", keywords[kw]
         self.kw = keywords[kw]
      print "self.radius =", self.radius


b = myClass(radius = 1.0)
                   

--------------------------------------------------------------------------
"Pretend like this is a really witty saying." - Anonymous
--------------------------------------------------------------------------






More information about the Python-list mailing list