checking if a list is empty

Hans Georg Schaathun hg at schaathun.net
Wed May 11 14:15:59 EDT 2011


On Wed, 11 May 2011 13:50:54 -0400, Prasad, Ramit
  <ramit.prasad at jpmchase.com> wrote:
:  I find this argument to be flawed. Should I stop using built-in 
: generators instead of range/xrange for looping through lists?
: Certainly for loops with loop counting are understood more widely
: than generators. Should I stop using any advanced feature Python
: because it is difficult to understand without knowing Python?

No; I'd suggest the most legible and intuitive construct that /does/ the
job.  Never something which requires one extra (illegible) page to do
the job, or something which does not do the job at all.

:  I may not have made the point well, but I cannot see any advantage 
: for trying to program for the lowest common denominator.

Common to what?  I'd try the lowest common denominator of
legibility and effictiveness.

It is just KISS.

-- 
:-- Hans Georg



More information about the Python-list mailing list