Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Python 2.7.3 (default, Aug 1 2012, 05:16:07)
- [GCC 4.6.3] on linux2
- Type "copyright", "credits" or "license()" for more information.
- ==== No Subprocess ====
- >>> class A(object):
- def __init__(self, **kwargs):
- self.__dict__= kwargs
- >>> class B(object):
- def __init__(self, **kwargs):
- self.__dict__.update(kwargs)
- >>> a=[A(code=1), A(code=2)]
- >>> b=[B(code=1), B(code=2)]
- >>> import operator
- >>> a.sort(key=operator.attrgetter("code"))
- >>> b.sort(key=operator.attrgetter("code"))
- >>>
Advertisement
Add Comment
Please, Sign In to add comment