[prev in list] [next in list] [prev in thread] [next in thread]
List: python-list
Subject: Re: Decorators, Identity functions and execution...
From: Jorge Godoy <godoy () ieee ! org>
Date: 2006-04-09 14:42:34
Message-ID: 87fykm7qud.fsf () ieee ! org
[Download RAW message or body]
Chance Ginger <cginboston@hotmail.com> writes:
> On Sun, 09 Apr 2006 09:51:18 +0200, Fredrik Lundh wrote:
>
>> Chance Ginger" wrote:
>>
>>> If I define a decorator like:
>>>
>>> def t(x) :
>>> def I(x) : return x
>>> return I
>>
>> ... you get a syntax error.
>>
>
> It isn't a syntax error...I tried it before I posted. In fact
> def t(x) :
> def I(x) : return x
> return I
>
> is correct.
Indeed. This is correct. Fredrick's comment was related to the lack of
indentation in your code.
>
>>> and use it like:
>>>
>>> @t(X)
>>> def foo(a) :
>>> # definition of foo...
>>> pass
>>
>> that's also a syntax error.
>
> Once again this isn't an error assuming you pass in a valid 'X'.
If your indentation is broken as above it doesn't matter what 'X' is.
--
Jorge Godoy <godoy@ieee.org>
"Quidquid latine dictum sit, altum sonatur."
- Qualquer coisa dita em latim soa profundo.
- Anything said in Latin sounds smart.
--
http://mail.python.org/mailman/listinfo/python-list
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic