Using Python class as a data container -
Sometimes it connects the related data to the cluster. I do this with a word like
self.group = dict (a = 1, b = 2, c = 3) self.group ['a']
One of my colleagues I like to create a class
class group square (object): def __init __ (a, b, c): self. A = a self .b = b self.c = c self.group = groupClass (1, 2, 3) print self.group.a
Note that we can not use any class methods Are not defined.
I like to use a word because I like to reduce the number of lines of code. My colleague believes that if you use class, the code is more readable, and it is easier to add methods in classes in the future.
Whom do you like and why?
If you never really define methods of a class, then a motive or a More matters in the opinion. Simple + Biltin is good! However, for each self.
Comments
Post a Comment