mò
–MÊEc           @   sN   d  Z  d Z d Z d „  Z d f  d „  ƒ  YZ d f  d „  ƒ  YZ e ƒ  Z d S(	   sœ  Shorthand syntax for making thunks.

Use _ as a placeholder in an expression to create a one-argument
function that fills in the placeholder and evaluates the expression.
For example:

    >>> from thunk import _
    >>> numbers = [3, 8, 4, 1, 2]
    >>> filter(_ < 5, numbers)
    [3, 4, 1, 2]
    >>> map(_ + 7, numbers)
    [10, 15, 11, 8, 9]
    >>> words = 'lovely spam and eggs'.split()
    >>> filter(_.endswith_('s'), words)
    ['eggs']
    >>> 

Notice that when calling a method on _ you need to append an
underscore to the method name (in order to distinguish a method
call from an attribute lookup.

The illusion is far from complete, but it's a fun hack.s   Ka-Ping Yees
   2007-02-07c         C   s   |  S(   N(   t   x(   R    (    (    t
   ./thunk.pyt   identity   s    t	   CallThunkc           B   s   t  Z d „  Z d „  Z RS(   Nc         C   s   | |  _  | |  _ d  S(   N(   t   thunkt   selft   name(   R   R   R   (    (    R   t   __init__   s    	c            s%   |  i ‰ ‡  ‡ ‡ d †  } t | ƒ S(   Nc            s   t  |  ˆ ƒ ˆ  ˆ Ž  S(   N(   t   getattrt   targetR   t   argst   kw(   R	   (   R
   R   R   (    R   R   %   s    (   R   R   R   t   Thunk(   R   R
   R   R   R   (    (   R
   R   R   R   t   __call__#   s    	(   t   __name__t
   __module__R   R   (    (    (    R   R      s   	R   c           B   s‰   t  Z e d „ Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 „  Z d
 „  Z d „  Z d „  Z d „  Z d „  Z RS(   Nc         C   s   | |  _  d  S(   N(   R   R   (   R   R   (    (    R   R   *   s    c         C   s   |  i | ƒ S(   N(   R   R   R	   (   R   R	   (    (    R   R   -   s    c            s   ‡  d †  } t | ƒ S(   Nc            s
   |  ˆ  j  S(   N(   R	   t   other(   R	   (   R   (    R   R   1   s    (   R   R   (   R   R   R   (    (   R   R   t   __lt__0   s    c            s   ‡  d †  } t | ƒ S(   Nc            s
   |  ˆ  j S(   N(   R	   R   (   R	   (   R   (    R   R   6   s    (   R   R   (   R   R   R   (    (   R   R   t   __le__5   s    c            s   ‡  d †  } t | ƒ S(   Nc            s
   |  ˆ  j S(   N(   R	   R   (   R	   (   R   (    R   R   ;   s    (   R   R   (   R   R   R   (    (   R   R   t   __gt__:   s    c            s   ‡  d †  } t | ƒ S(   Nc            s
   |  ˆ  j S(   N(   R	   R   (   R	   (   R   (    R   R   @   s    (   R   R   (   R   R   R   (    (   R   R   t   __ge__?   s    c            s   ‡  d †  } t | ƒ S(   Nc            s
   |  ˆ  j S(   N(   R	   R   (   R	   (   R   (    R   R   E   s    (   R   R   (   R   R   R   (    (   R   R   t   __eq__D   s    c            s   ‡  d †  } t | ƒ S(   Nc            s
   |  ˆ  j S(   N(   R	   R   (   R	   (   R   (    R   R   J   s    (   R   R   (   R   R   R   (    (   R   R   t   __ne__I   s    c            s   ‡  d †  } t | ƒ S(   Nc            s   |  ˆ  S(   N(   R	   R   (   R	   (   R   (    R   R   O   s    (   R   R   (   R   R   R   (    (   R   R   t   __add__N   s    c            s   ‡  d †  } t | ƒ S(   Nc            s   |  ˆ  S(   N(   R	   R   (   R	   (   R   (    R   R   T   s    (   R   R   (   R   R   R   (    (   R   R   t   __sub__S   s    c            s   ‡  d †  } t | ƒ S(   Nc            s   |  ˆ  S(   N(   R	   R   (   R	   (   R   (    R   R   Y   s    (   R   R   (   R   R   R   (    (   R   R   t   __mul__X   s    c            s   ‡  d †  } t | ƒ S(   Nc            s   |  ˆ  S(   N(   R	   R   (   R	   (   R   (    R   R   ^   s    (   R   R   (   R   R   R   (    (   R   R   t   __div__]   s    c            sb   ˆ  d d g j o t ˆ  ƒ ‚ n ˆ  i d ƒ o t |  ˆ  d  ƒ Sn ‡  d †  } t | ƒ Sd  S(   Nt   __repr__t
   __coerce__t   _iÿÿÿÿc            s   t  |  ˆ  ƒ S(   N(   R   R	   R   (   R	   (   R   (    R   R   h   s    (   R   t   AttributeErrort   endswithR   R   R   R   (   R   R   R   (    (   R   R   t   __getattr__b   s    c            s   ‡  d †  } t | ƒ S(   Nc            s   |  ˆ  S(   N(   R	   R   (   R	   (   R   (    R   R   m   s    (   R   R   (   R   R   R   (    (   R   R   t   __getitem__l   s    (   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R    R!   (    (    (    R   R   )   s   												
N(   t   __doc__t
   __author__t   __date__R   R   R   R   (   R   R#   R$   R   R   R   (    (    R   t   ?   s   	H