anonfunc 1.0
============

Copyright(C) 2003-2004 Hye-Shik Chang.
$Perky: anonfunc/README,v 1.2 2004/01/03 13:27:39 perky Exp $


Introduction
------------

This package 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.

It will not work for these cases:

1) Calling original object doesn't work because it makes
   anonymous function.

	>>> f = X()
	Traceback (most recent call last):
	  File "<stdin>", line 1, in ?
	TypeError: argument 0 is required.

2) Inquiry operators like in, nonzero, is, cmp doesn't work
   because Python object protocol uses 'int' as return value
   for these operators.

	>>> f = X in range(5)
	>>> f(5)
	Traceback (most recent call last):
	  File "<stdin>", line 1, in ?
	TypeError: 'bool' object is not callable

3) Non-operator stuffs.

	>>> f = (X, Y)
	>>> f(1, 2)
	Traceback (most recent call last):
	  File "<stdin>", line 1, in ?
	TypeError: 'tuple' object is not callable

	>>> f = len(dir(X))
	Traceback (most recent call last):
	  File "<stdin>", line 1, in ?
	TypeError: argument 0 is required.

Use it after you know what really it is. :)


Requirement
-----------

This package requires Python 2.3 or later.


Author
------

Hye-Shik Chang <perky@FreeBSD.org>

Any comments, suggestions, and/or patches are very welcome.
Thank you for using anonfunc!
