Let's say I have a class defined as follow :
class Foo():
baz = None
def __init__(self, bar):
self.bar = bar
Now, in that example Foo.baz is None. Now let's say that this class attribute needs to be an instance of Foo like below:
class Foo():
baz = Foo("baz")
def __init__(self, bar):
self.bar = bar
How would I proceed?
Similarly, is there any way to create a "class property". I know I can assign a lambda function returning a new instance of the class to a class attribute, but I'd rather not have to write the parenthesis.