Can I declare Python class fields outside the constructor method?
问题 I am absolutly new in Python (I came from Java) and I have the following doubts about class fields. Considering a code like this: class Toy(): def__init__(self, color, age): self.color = color self.age = age action_figure = Toy('red', 10) Ok, what is done it is clear and very simple: it is defining a Toy class. In the constructor method is defining two fields and how to set the fields value. Finnally (in the "main") it is created a new Toy instance passing the values of the field in the