Immutability and Python
Ian Kelly
ian.g.kelly at gmail.com
Mon Oct 29 16:18:09 EDT 2012
On Mon, Oct 29, 2012 at 1:36 PM, Chris Angelico <rosuav at gmail.com> wrote:
> Question: Is it clearer to take advantage of the fact that the base
> class can be an arbitrary expression?
>
> class MyImmutableClass(namedtuple('MyImmutableClass', 'field1 field2
> field3 field4')):
>
> You lose the unnecessary temporary and triplication of name, but gain
> instead a rather long line.
I think it's more readable if separated, but YMMV.
More information about the Python-list
mailing list