Skip to content

Instantly share code, notes, and snippets.

@bebraw
Created December 13, 2009 12:13
Show Gist options
  • Save bebraw/255394 to your computer and use it in GitHub Desktop.
Save bebraw/255394 to your computer and use it in GitHub Desktop.
# -*- 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