On Tue, 30 Nov 2004 19:38:46 GMT, "Paul McGuire"
<[EMAIL PROTECTED]> wrote:

>"km" <[EMAIL PROTECTED]> wrote in message
>news:[EMAIL PROTECTED]
>> Hi all,
>>  was going thru the new features introduced into python2.4 version.
>> i was stuck with 'decorators' -  can someone explain me the need of such a
>thing called decorators ?
>> tia
>> KM
>
>Here are some example on the Python Wiki:
>http://www.python.org/moin/PythonDecoratorLibrary
>
>I think memoize is my favorite so far.

Memoize is certainly a readily approachable example.

But the factorial example on the wiki has a defect.  It incorrectly
calculates factorial(0) as 0, when it should be 1.  I don't know how
to edit the "inline" code in the wiki, but if someone out there knows
how, consider changing:

    if n < 2:
        return n

to:

    if n < 2:
        return 1

Have a nice day!
    --dang
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to