Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #32420

Re: Immutability and Python

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.149
X-Spam-Level *
X-Spam-Evidence '*H*': 0.70; '*S*': 0.00; 'subject:Python': 0.05; 'oct': 0.16; 'readable': 0.16; 'mon,': 0.16; 'wrote:': 0.17; 'header:In-Reply-To:1': 0.25; 'message-id:@mail.gmail.com': 0.27; 'chris': 0.28; 'question:': 0.29; 'class': 0.29; 'received:209.85.215.46': 0.30; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'pm,': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'skip:m 40': 0.36; 'rather': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'fact': 0.38; 'instead': 0.39; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'think': 0.40; 'more': 0.63; 'unnecessary': 0.65; 'lose': 0.71; 'gain': 0.79; 'clearer': 0.84; 'to:name:python': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=RajtQ5O3MmfOtC/FZpyXatcPIdv2kCU7vmFd6U2Q29w=; b=Twl4ONt6i3E8Eg5a2zKmqxtABSl3L2WN5VsMfiHy0HkHydbSuOSTl6GAt91FOvT/sR 5639+MY7h8fvTMnpdoQTFDvoFg1X/JQA6NoUCQYJfn0+M+knoKYO0+N/or+JOyZJ53NM 5zZGf0paO50ZA73rVsNV2auw91iElQMgV62su0ZlFrc8nY0mKo7UhhVStvNTegGiaXSO qnpb94KEB20TzegGdT+dynKiOmcZJZIurF6KfK17zAofhUbtLSN8a26+1yJgKsKWJHI4 pc+lIvrsPkNSrTe0jU4G97fWOUYoRrEa0VJ4AFXQ2YTwr430UmjGgYym2kWo+ySOeKNE iPGg==
MIME-Version 1.0
In-Reply-To <CAPTjJmqddx9sz5YoYQLy5eT7rWs8FdwCrvtHcNjdqPFu6e2+fw@mail.gmail.com>
References <CAF_E5Jbf0KJjDLV0jS-p_J9E4D8=_sPScgE+vkmkN2sMw=3aoA@mail.gmail.com> <1793477354.3492917.1351526431192.JavaMail.root@sequans.com> <CAF_E5JYRWxChJMHZc62d74Xnw88S2FhcXqot2V0hPuxfgbzbuw@mail.gmail.com> <CALwzidmjXz4JuYRCkWtXtHtDcv7DLzFjfUUxWuopwafmTHoP-g@mail.gmail.com> <CAPTjJmqddx9sz5YoYQLy5eT7rWs8FdwCrvtHcNjdqPFu6e2+fw@mail.gmail.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Mon, 29 Oct 2012 14:18:09 -0600
Subject Re: Immutability and Python
To Python <python-list@python.org>
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3045.1351541921.27098.python-list@python.org> (permalink)
Lines 11
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1351541921 news.xs4all.nl 6901 [2001:888:2000:d::a6]:58684
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:32420

Show key headers only | View raw


On Mon, Oct 29, 2012 at 1:36 PM, Chris Angelico <rosuav@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.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Immutability and Python Ian Kelly <ian.g.kelly@gmail.com> - 2012-10-29 14:18 -0600

csiph-web