I have a python3 class defined as such:
class Institution(object):
def __init__(self, *args):
self.name = args[0].strip()
self.authors = set()
[...]
As name
describes the institution, I'd like name
not to be an attribute of the institution but rather the base of the class.
Therefore, I changed the definition to:
class Institution(str,object):
and I'd like to be able to access self
seen for a str
point of view.
Within __init__(self, *args)
, I tried :
self = args[0].strip() # → 'str' object has no attribute 'authors'
str(self) = args[0].strip() # → can't assign to function call
str.__init__(self, args[0].strip()) # → object.__init__() takes no parameters
super(str, self).__init__(args[0].strip()) # → object.__init__() takes no parameters
super(str, self) = args[0].strip() # → can't assign to function call
Is there any way to achieve what I'm trying to do ?