Adding new math operators

Huaiyu Zhu hzhu at localhost.localdomain
Thu Aug 3 14:08:28 EDT 2000


On Thu, 3 Aug 2000 16:12:30 +0200, Alex Martelli <alex at magenta.com> wrote:
>
>Python's current semantic for and/or is different:
>
>>>> print 2 and 3
>3
>>>> print 2 or 3
>2
>

Oops.  Of course you are right.  This is still consistent with using ~and
~or ~not for bitwise operators, though.

BTW, to prevent this being quoted out of context, I'd like to point out this
part is not the proposed extension.  Now that this is clear, let's take some
further digressions:

Use ~f(a, b) in place of map(f, a, b)
Use ~~f(a, b) in place of map(lambda f=f,*x:apply(map, [f]+x), a, b)
etc.

That is, use ~ as an "elementwise meta-character".

Huaiyu



More information about the Python-list mailing list