Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Foo:
- def __new__(cls,...):
- fields = {'a': 1, 'b': 2', ...}
- new_src = 'def __new__(_cls, {fields})\n:'
- ' return _tuple.__new__(_cls, ({fields})\n'.format(fields = ', '.join(fields))
- exec(new_src, {'_tuple': tuple} ..)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement