For review: PEP 308 - If-then-else expression

Carlos Ribeiro cribeiro at mail.inet.com.br
Sun Feb 9 13:55:07 EST 2003


On Sunday 09 February 2003 01:30, Paul Paterson wrote:
> As per a different thread where I did the reverse and searched the Python
> code in the Python standard library + assorted packages on my system. I
> found,
>
> 769 candidates where the conditional expression could be used to replace an
> assignment
> 381210 lines of code
>
> So as a rough estimate we get one use per (381210 - 4*769)/769 = 491 /lines
> of code.

Frequency of usage is *not* a good metric. What counts is having the right 
tool for the job, when you happen to need it.

Just for a funny counter example: in my standard installation of Mandrake, on 
/usr/lib/python, I got the following counts:

59520 lines of code
152 occurrences of 'continue'
306 occurrences of 'break'
353 occurrences of 'pass'.

Does any of the above mean that 'continue', 'break', or 'pass' aren't worth to 
be part of the language?

Seriously, it's too easy to get confused with statistics. Let us not even try.


Carlos Ribeiro
cribeiro at mail.inet.com.br





More information about the Python-list mailing list