Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Coin:
- def __init__(self, **kwargs):
- for k, v in kwargs.items():
- setattr(self, k, v)
- def __call__(self, *args, **kwargs):
- for value in args:
- if type(value) in (int, float):
- self.__setattr__('price', float(value))
- def todict(self):
- return {attr: getattr(self, attr) for attr in dir(self)
- if not callable(getattr(self, attr)) and not attr.startswith("__")}
Advertisement
Add Comment
Please, Sign In to add comment