I'm coming from a C++ background to python
I have been declaring member variables and setting them in a C++esqe way like so:
class MyClass:
my_member = []
def __init__(self,arg_my_member):
self.my_member = arg_my_member
Then I noticed in some open source code, that the initial declaration my_member = []
was completely left out and only created in the constructor.
Which obviously is possible as python is dynamic.
My question is, is this the preferred or Pythonic way of doing things, and are there and pros and cons of either?