Equivalent to (a ? b : c) ?

Gareth McCaughan Gareth.McCaughan at pobox.com
Tue Dec 21 19:15:15 EST 1999


Rob Hodges wrote:

[someone else:]
>>>> ((a and (b,)) or (c,))[0]
> Someone mentioned that this is idiomatic Python, but actually it is
> idiomatic lisp.

Eh?

Certainly (if a b c) is idiomatic Lisp with the same meaning,
but the particular hack involved certainly isn't. You *could*
say something like
  (car (or (and a (list b)) (list c)))
but that would be horribly unidiomatic Lisp. I'm not sure
what the point is here.

-- 
Gareth McCaughan  Gareth.McCaughan at pobox.com
sig under construction



More information about the Python-list mailing list