≈ the.bay.news

What is the best practice to declare and initialize in __init__ function?

Discussions on Python.org
What is the best practice to declare and initialize in __init__ function?
Continuing the discussion from Python should introduce the concept of variable declaration to prevent potential issues that may arise from variable redefinition. : Hi all, I’m new here and I have a little question when I take up writing my own classes. The biggest problem is about class initialization. Python mixes declaration with assignment, so I’m not sure whether I should do this: class myclass: def __init__(self, object_): # declaration self.__var = None # assi...

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.