With Python 3.5, I want to build a new class which is tuple wrapping an association of datastructures in order to perform some operation. It happens that I would also need some attributes. So I wrote this:
class tuplewrapper:
def __init__(self, dict={}):
print("initiating")
data=dict
self=tuple([dict(),dict()])
self.keys=iter(self[0])
self.values=iter(self[1])
self.put(data)# another function that add data in the dict as self.keys and self.values. *No need to describe, as the problem is in __init__ and mostly about syntax...*
I know this look similar to keys and values of a dict, but I need to do some special processing and this class would be very useful doing it.
The problem being that since I define self as tuple([dict(),dict()]); Python is returning AttributeError since tuple has no such keys as keys and values.
Which is precisely why I built this class in addition to add functions to this.
So what am I doing bad?
How to correct this? I don't know how to use "super" as documentation is not pretty explicit about it (and this didn't help), and for me it was pretty much acquired that in init, I could define the things however I wanted because it is the interest of the thing, but It seems I pretty much misunderstood the concept.
So, how do I do this, please?