When I create a class in Python, I have to declare variables with self.
:
class ClassName(object):
def __init__(self, arg):
super(ClassName, self).__init__()
self.arg = arg
Great, but to instantiate it, I need to pass arguments to the init
the method...but what if I don't have them, or don't want to bother with them?
I want something like
def __init__(self):
super(ClassName, self).__init__()
self.arg
...to later on refer to an existing but empty arg
.
Edit.
By existing but empty I meant C-like behaviour:
int a;
...where variable a
exists but has no value. Even gcc refers to that as empty
, so I presumed that question would be clear.
Default values are as close as probably could be to what I want, I will use that.