How to refer to class name and function name in a python program?

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Mon Oct 5 23:05:18 EDT 2009


En Mon, 28 Sep 2009 22:54:55 -0300, Peng Yu <pengyu.ut at gmail.com> escribió:
> On Sun, Sep 20, 2009 at 12:43 PM, Benjamin Kaplan
> <benjamin.kaplan at case.edu> wrote:
>> On Sun, Sep 20, 2009 at 12:43 PM, Peng Yu <pengyu.ut at gmail.com> wrote:
>>> On Sun, Sep 20, 2009 at 11:32 AM, Vijayendra Bapte
>>> <vijayendra.bapte at gmail.com> wrote:

>>>> class A:
>>>>
>>>>    @echo
>>>>    def __repr__(self):
>>>>        pass
>>>
>>> What does @echo mean?
>>
>> It's a decorator, which wraps the function with another function
>
> I looked at the table of content of python tutorial at
> http://docs.python.org/tutorial/
>
> But I don't see which section discuss this concept. If it is there,
> would you please let me know which section I should read. Or this
> concept is discussed somewhere else?

It isn't menctioned in the tutorial - look in the Glossary, or the  
original PEP [1]
There's a good introduction by Bruce Eckel at [2], and the decorator  
module by M. Simionato is a must [3]

[1] http://www.python.org/dev/peps/pep-0318/
[2] http://www.artima.com/weblogs/viewpost.jsp?thread=240808
[3] http://pypi.python.org/pypi/decorator

-- 
Gabriel Genellina




More information about the Python-list mailing list