This file contains hidden or 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
| import timeit | |
| def strip(a_string): | |
| return a_string.strip() | |
| results_map = [] | |
| results_list_comprehension = [] | |
| comp_list = [' 123', ' 123', '123', '123 ','123 '] | |
| def strip_map(): |
This file contains hidden or 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 Require(object): | |
| @staticmethod | |
| def assert_equals(expected, expectee, comment="") | |
| try: | |
| assert expected == expectee | |
| except AssertionError: | |
| comment = "%s, " if comment | |
| raise AssertionError(comment + "expected: %r, but was: %r" % (expected, expectee)) |
This file contains hidden or 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 Entity(object): | |
| errors = {} | |
| validators = {} | |
| def __init__(self, **kwargs): | |
| for name, value in kwargs.iteritems(): | |
| try: | |
| if self._is_extra_property(name, value): | |
| self._extra_properties(name, value) |
NewerOlder