Elementwise -//- first release -//- Element-wise (vectorized) function, method and operator support for iterables in python.

Joshua Landau joshua.landau.ws at gmail.com
Wed Dec 21 14:00:38 EST 2011


On 21 December 2011 18:57, Ian Kelly <ian.g.kelly at gmail.com> wrote:

> On Wed, Dec 21, 2011 at 9:48 AM, Joshua Landau
> <joshua.landau.ws at gmail.com> wrote:
> > NOW (the PEP):
> > item = foreignfunc1~(item)
> > item = foreignfunc2~(item)
> > item = foreignfunc3~(item)
>
> Just a note: PEP 225 does not actually include this syntax for
> arbitrary function calls.  It only proposes to augment the arithmetic
> and assignment operators.
>

Not quite. They never seem to have come to an agreement (the whole thing is
deferred) but they do touch upon "~f(x)":


5. Using ~ as generic elementwise meta-character to replace map

          ~f(a, b)               # map(f, a, b)
          ~~f(a, b)              # map(lambda *x:map(f, *x), a, b)

       More generally,

          def ~f(*x): return map(f, *x)
          def ~~f(*x): return map(~f, *x)
          ...

I used "f~(x)" because it's not ambiguous with the current binary not operator.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20111221/a9772330/attachment-0001.html>


More information about the Python-list mailing list