Can global variable be passed into Python function?

Mark H. Harris harrismh777 at gmail.com
Sat Mar 1 16:40:20 EST 2014


On Saturday, March 1, 2014 12:24:15 AM UTC-6, Chris Angelico wrote:
> much code. If you want to change anything, you potentially have to
> 
> edit three places: the list of constants at the top, the condition
> 
> function, and the switch.
> 
> 
> 
> This can't be your idea of readability. Show me where I'm wrong.
> 
> 
> 
> ChrisA

hi Chris,  I don't think you're wrong.  There are two issues for me (and one of them is not how the switch is implemented).

1) Is it easier for average users of python as a language to read switch case default,  or if elif else ?

2) Would most average users concur that 'readable' means something like, "readily understandable at quick glance, or rapid preview" (or quiv).

I readily admit that 'subjective' is the operative work here. As Guido found at his 2007 keynote most experienced devs are not clamoring for a switch block. Just so. But I'm not thinking of experienced devs. I'm thinking of the average coder who is used to looking at switch blocks.  

I personally can see and understand a switch block 2x to 3x faster than looking at an elif chain. Because I am primarily a C programmer and I personally use and read switch blocks.

An experienced python dev can readily 'see' an elif chain, well, because that's all they have and that's all they look at day to day.  So, naturally a python dev is going to think an elif chain is readable. 

Thank you sir, you have good insights. A quote from the high seas is classy.

(another post with no elipses)

Cheers



More information about the Python-list mailing list