Code style query: multiple assignments in if/elif tree

Rhodri James rhodri at wildebst.org.uk
Mon Mar 31 22:31:59 CEST 2014


On Mon, 31 Mar 2014 17:29:54 +0100, Chris Angelico <rosuav at gmail.com>  
wrote:

> On Tue, Apr 1, 2014 at 3:20 AM, Rustom Mody <rustompmody at gmail.com>  
> 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



More information about the Python-list mailing list