Why prefer != over <> for Python 3.0?

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Sun Mar 30 13:27:49 CEST 2008


hdante:
> it's already time that programmer editors
> have input methods advanced enough for generating this:
> if x ≠ 0:
>     ∀y ∈ s:
>         if y ≥ 0: f1(y)
>         else: f2(y)

Take a look at Fortress language, by Sun. A free (slow) interpreter is
already available.
(Mathematica too allows you to write those symbols, but it costs a
lot, and (despite tons of good things it has) as *programming
language* it's awful, IHMO).


Steven D'Aprano:
> In Python we can write the above as:
> if x != 0:
>     [f1(y) if y >= 0 else f2(y) for y in s]

Your code builds an actual array (Python list) of results, while I
think the original code just calls f1/f2.

Bye,
bearophile



More information about the Python-list mailing list