Saturday 15 September 2012

python - How assign to a class attribute an instance from another class residing on the same module -


I can not understand how to solve this problem:

  class clause: Empty = Clazz1 (none, none) def __init __ (self): self.item = Clazz1 ("a", "b") class clazz1: def __init __ (self, key, value): self.key = key Self.value = value if __name __ =   

When I try to run it return:

  traceback (last call call): file "C: \ user \ desktop \ test.py", line 1, & lt; Module & gt; The name Claude 1 is not defined   

The file "C: \ user \" in the "Class Clauses" is not defined: Clause Clauses: Clause Empty = Claz 1 (none, none) Name: Desktop \ some measure? Thanks in advance

before Clazz1 Clazz: :

  class Clazz1: def __init __ (self, key, value): self.key = key self.value = value class Clazz: Empty = Clazz1 (none, None) def __init__ (self): self.item = Clazz1 ("a", "b") if __name__ == '__main__': h = clause ()    

No comments:

Post a Comment