In message <[EMAIL PROTECTED]>, Gary
Robinson wrote:

> I've just never liked the fact that you have to name the function when
> accessing those attributes from within the function.

If it's any consolation, it's not actually the function name you need to
refer to, merely any variable or Python object that happens to hold a
reference to the right function:

    >>> f = lambda x : x + x
    >>> f(2)
    4
    >>> f.myattr = "yeah"
    >>> g = f
    >>> g.myattr
    'yeah'
    >>> g = [f]
    >>> g[0].myattr
    'yeah'
    >>> g[0](3)
    6

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to