This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TraceBlock: | |
def message(self, arg): | |
print("running" + arg) | |
def __enter__(self): | |
print("starting with block") | |
return self | |
def __exit__(self, exc_type, exc_value, exc_tb): | |
if exc_type is None: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
[User(1), User(10), User(19), User(29)] | |
[User(1), User(10), User(19), User(29)] | |
""" | |
from operator import attrgetter | |
class User: | |
def __init__(self, user_id): | |
self.user_id = user_id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
[('tr', 90), ('uk', 44), ('us', 1)] | |
[('us', 1), ('uk', 44), ('tr', 90)] | |
[('tr', 90), ('uk', 44), ('us', 1)] | |
""" | |
from operator import itemgetter | |
rows = [ | |
("tr", 90), | |
("us", 1), | |
("uk", 44) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
[{'fname': 'Big', 'lname': 'Jones', 'uid': 1004}, {'fname': 'John', 'lname': 'Jones', 'uid': 1003}, {'fname': 'John', 'lname': 'Jones', 'uid': 8888}, {'fname': 'John', 'lname': 'Jones', 'uid': 9999}, {'fname': 'Rick', 'lname': 'Cleese', 'uid': 1001}, {'fname': 'Steve', 'lname': 'Madden', 'uid': 1002}] | |
[{'fname': 'Big', 'lname': 'Jones', 'uid': 1004}, {'fname': 'John', 'lname': 'Jones', 'uid': 1003}, {'fname': 'John', 'lname': 'Jones', 'uid': 8888}, {'fname': 'John', 'lname': 'Jones', 'uid': 9999}, {'fname': 'Rick', 'lname': 'Cleese', 'uid': 1001}, {'fname': 'Steve', 'lname': 'Madden', 'uid': 1002}] | |
""" | |
from operator import itemgetter | |
rows = [ | |
{'fname': 'John', 'lname': 'Jones', 'uid': 1003}, | |
{'fname': 'John', 'lname': 'Jones', 'uid': 9999}, | |
{'fname': 'John', 'lname': 'Jones', 'uid': 8888}, | |
{'fname': 'Steve', 'lname': 'Madden', 'uid': 1002}, |