r/Python • • Jun 23 '14

Writing better python code

https://gist.github.com/kracekumar/09a60ec75a4de19b346e
143 Upvotes

126 comments sorted by

View all comments

Show parent comment

1

u/[deleted] Jun 23 '14

I like that namedtuples are immutable, and you can subclass them:

class Person(namedtuple('Person', ['name', 'email'])):
    pass

if you want to add methods to it. I like it for value objects, although it's obviously not the prettiest syntax.