I have a class that only contains attributes and I would like packing/unpacking to work on it. What collections.abc
should I implement to get this behaviour?
class Item(object):
def __init__(self, name, age, gender)
self.name = name
self.age = age
self.gender = gender
a, b, c = Item("Henry", 90, "male")
I would like to avoid using a namedtuple
.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…