Learning Python, and has some basic doubts.
1. I have seen variable declaration (path here) as
class writer:
path = ""
sometimes, no explicit declaration but initialize through __init__.
def __init__(self, name):
self.name = name
I understand the purpose of __init__, but is it advisable to declare a variable in any other functions.
2. How can I create a variable to hold a custom type?
class writer:
path = "" # string value
customObj = ??