Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.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.077 X-Spam-Evidence: '*H*': 0.85; '*S*': 0.00; 'subject:Python': 0.05; 'received:mail-vb0-f46.google.com': 0.09; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'oct': 0.16; 'wrote:': 0.17; 'received:209.85.212.46': 0.18; 'header:In-Reply-To:1': 0.25; 'skip:m 30': 0.26; 'am,': 0.27; 'message- id:@mail.gmail.com': 0.27; 'received:209.85.212': 0.28; 'question:': 0.29; 'skip:_ 10': 0.29; 'class': 0.29; 'to:addr :python-list': 0.33; 'received:google.com': 0.34; '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; '30,': 0.62; 'unnecessary': 0.65; 'skip:n 30': 0.69; 'lose': 0.71; 'gain': 0.79; 'clearer': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=iQJE0GT38QVA9GgsFgz5slDC/TA3+a9jo4GQvd58Lp0=; b=fZxA/F+doMO2MR/NpJCjAoSykNJx+wUXFMNZfSRx6b73O/kbhgJQ2LHphT358RcHXB gbsnuJRyN2dyszxoyNm1RQlOtYRlvU9rvu7S5R9+VQhIjSm0uvMI+Uw8n2geuK8Sdo7U Tt/CeZNDtq9DlmYbd6qe/ZPmuCblRH9vBdN+vD0bXq8Rj05vhRNcNn4LuW55cHRK0fwb 9T89FY9TPVAXM4pUCAiCQ4DJpfyTDvg2QfsBN3Yfw3/ECYpovM7gDETfRL/yJ7enzP+R R808y/aYtFWMocvsWRmofabc2dN4Tzn376scLnYYJlLkx+xN+RArspf+Ruiij4ZeWHo0 4sOA== MIME-Version: 1.0 In-Reply-To: References: <1793477354.3492917.1351526431192.JavaMail.root@sequans.com> Date: Tue, 30 Oct 2012 06:36:52 +1100 Subject: Re: Immutability and Python From: Chris Angelico To: 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 16 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1351539416 news.xs4all.nl 6981 [2001:888:2000:d::a6]:47693 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:32419 On Tue, Oct 30, 2012 at 6:23 AM, Ian Kelly wrote: > _MyImmutableClass = namedtuple('MyImmutableClass', 'field1 field2 > field3 field4') > > class MyImmutableClass(_MyImmutableClass): 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. ChrisA