Created
December 13, 2009 12:13
-
-
Save bebraw/255394 to your computer and use it in GitHub Desktop.
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
# -*- coding: utf-8 -*- | |
class MyList(list): | |
def __init__(self, items, more): | |
# modify items here | |
new_items = map(lambda x: x + '_hi', items) | |
super(MyList, self).__init__(new_items) | |
# assign rest here | |
self.more = more | |
my_list = MyList(['a', 'b', 'c'], 'stuff') | |
assert my_list == ['a_hi', 'b_hi', 'c_hi'] | |
assert my_list.more == 'stuff' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment