I have this function (includes description):
def deep_list(x):
"""fully copies trees of tuples to a tree of lists.
deep_list( (1,2,(3,4)) ) returns [1,2,[3,4]]"""
if type(x)!=type( () ):
return x
return map(deep_list,x)
I would like to insert that function into a functions class I’ve made, so I need to add self to the function arguments at the beginning.
My problem is this:
How do I insert in the right way self to the ‘map’ function in the end of the deep_list?
Depends how
xrelates to your class.One way is to make the function a static method. This is probably the least likely
If you mean to operate on an attribute, then do it this way
Finally, if you are subclassing
listor making a sequence like class, you may just useself