Why ELIF?

Erik Max Francis max at alcyone.com
Sun Oct 11 09:07:18 CEST 2009


metal wrote:
> I wonder the reason for ELIF. it's not aligned with IF, make code ugly
> IMHO
> 
> OR maybe better?
> 
> if foo == bar:
> 	...
> or foo == baz:
> 	...
> or foo == bra:
> 	...
> else:
> 	...

Because that's uglier.  `or` means something completely unrelated in 
expressions.  Variations of `else if` in `if ... else if ...` chains is 
routine in computer languages.  Choosing a deliberately different syntax 
just for the sake it of is obtuse at best.

-- 
Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
  San Jose, CA, USA && 37 18 N 121 57 W && AIM/Y!M/Skype erikmaxfrancis
   And covenants, without the sword, are but words and of no strength to
    secure a man at all. -- Thomas Hobbes, 1588-1679



More information about the Python-list mailing list