Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!weretis.net!feeder1.news.weretis.net!news.roellig-ltd.de!open-news-network.org!cyclone03.ams2.highwinds-media.com!news.highwinds-media.com!voer-me.highwinds-media.com!post01.fr7!fx36.am4.POSTED!not-for-mail Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes Newsgroups: comp.lang.python Subject: Re: Code style query: multiple assignments in if/elif tree References: <874n2ecr5x.fsf@elektro.pacujo.net> <6775d115-a592-4082-a427-5789e1dd2875@googlegroups.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: "Rhodri James" Organization: The Wildebestiary Message-ID: User-Agent: Opera Mail/12.16 (Linux) Lines: 23 NNTP-Posting-Host: 81.97.70.240 X-Complaints-To: http://netreport.virginmedia.com X-Trace: 1396297919 81.97.70.240 (Mon, 31 Mar 2014 20:31:59 UTC) NNTP-Posting-Date: Mon, 31 Mar 2014 20:31:59 UTC Date: Mon, 31 Mar 2014 21:31:59 +0100 X-Received-Body-CRC: 3039837425 X-Received-Bytes: 1960 Xref: csiph.com comp.lang.python:69446 On Mon, 31 Mar 2014 17:29:54 +0100, Chris Angelico wrote: > On Tue, Apr 1, 2014 at 3:20 AM, Rustom Mody > wrote: >> On the whole I prefer multiple assignments. >> Maybe in this case use small variable names with >> separate(d) explanatory comments?? > > Shorter variable names would certainly be the more normal, heh. I let > my brother do that part of the typing, picking names and so on. Better > for teaching to let the victi-- err, the student have the power to > choose. :) Not just more normal, but more readable too. The trouble with your original example was that the lines were too long (even ignoring the trouble line-wrapping caused in your post) to take in with only a couple of eye movements along the line. That makes a really quite surprising difference to the comprehensibility of the whole thing. -- Rhodri James *-* Wildebeest Herder to the Masses