Re: Immutability and Python

Discussion in 'Python' started by Ian Kelly, Oct 29, 2012.

  1. Ian Kelly

    Ian Kelly Guest

    On Mon, Oct 29, 2012 at 1:36 PM, Chris Angelico <> 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.
    Ian Kelly, Oct 29, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. andrea crotti

    Immutability and Python

    andrea crotti, Oct 29, 2012, in forum: Python
    Replies:
    8
    Views:
    205
    Thomas Rachel
    Nov 8, 2012
  2. andrea crotti

    Re: Immutability and Python

    andrea crotti, Oct 29, 2012, in forum: Python
    Replies:
    0
    Views:
    163
    andrea crotti
    Oct 29, 2012
  3. andrea crotti

    Re: Immutability and Python

    andrea crotti, Oct 29, 2012, in forum: Python
    Replies:
    0
    Views:
    161
    andrea crotti
    Oct 29, 2012
  4. Mark Lawrence

    Re: Immutability and Python

    Mark Lawrence, Oct 29, 2012, in forum: Python
    Replies:
    0
    Views:
    170
    Mark Lawrence
    Oct 29, 2012
  5. Paul Rubin

    Re: Immutability and Python

    Paul Rubin, Oct 29, 2012, in forum: Python
    Replies:
    7
    Views:
    146
    Steven D'Aprano
    Oct 29, 2012
Loading...

Share This Page