When should I define a class Python?

Whenever you need to maintain a state of your functions and it cannot be accomplished with generators (functions which yield rather than return). Generators maintain their own state. If you want to override any of the standard operators, you need a class.

Sizin İçin Seçtik  Para çarpanının değerini ne arttırır?

Leave a Reply

Your email address will not be published. Required fields are marked *