Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ANN: Anonfunc 1.0

0 views
Skip to first unread message

Hye-Shik Chang

unread,
Jan 3, 2004, 9:58:40 PM1/3/04
to
Hello!

Anonfunc module is a C extension module provides very simple proxy
object that creates anonymous functions based on they got operated.
See the demo:

(X, Y, Z is provided to builtins from anonfunc automatically.)

>>> f = X + Y * Z
>>> f(1, 2, 3)
7

>>> f = divmod(X ** 3 + X ** 2, 5)
>>> f(12)
(374, 2)

>>> f = X[:5] + Y[-5:]
>>> f(range(10), range(20))
[0, 1, 2, 3, 4, 15, 16, 17, 18, 19]

>>> f1 = X ** 3 + 3 * (X ** 2)
>>> f2 = X + Y % X
>>> (f1 * f2)(3, 4)
216

>>> import sys
>>> f = anonfunc('mod').platform
>>> f(mod=sys)
'freebsd5'

But you can't use it with complete set of python operators because
anonfunc implementation is just based on operator overloadings.
Use it after you know what really it is. :)

You can download it from
http://www.freebsd.org/cgi/pds.cgi?ports/devel/py-anonfunc

Thank you!


Regards,
Hye-Shik

0 new messages