checking if a list is empty

Chris Angelico rosuav at gmail.com
Wed May 11 12:05:21 EDT 2011


On Thu, May 12, 2011 at 1:50 AM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> On Wed, 11 May 2011 15:05:45 +0100, Hans Georg Schaathun wrote:
>
>> My concern was with the reader and not the writer.
>>
>> What could elif mean other than else: if?
>
> The first time I read Python code, I had literally no idea what to make
> of elif. It seemed so obvious to me that any language would let you write
> "else if ..." (on a single line) that I just assumed that elif must be
> some other construct, and I had no idea what it was. It never even
> crossed my mind that it could be "else if" rammed together into one word.

In a Bourne shell script, if ends with fi... case ends with esac... so
file would end with... hmm. Yeah, I think it's best to know the
language you're trying to comprehend, and/or actually look at context
instead of shoving a piece of code under someone's nose and saying "I
bet you can't figure out what THIS does!".

Chris Angelico



More information about the Python-list mailing list