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: 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: References: <1793477354.3492917.1351526431192.JavaMail.root@sequans.com> From: Ian Kelly Date: Mon, 29 Oct 2012 14:18:09 -0600 Subject: Re: Immutability and Python To: Python 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 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.