decorators when?

David C. Ullrich dullrich at sprynet.com
Tue May 27 11:59:24 EDT 2008


In article <mailman.1649.1211900977.12834.python-list at python.org>,
 "Gabriel Genellina" <gagsl-py2 at yahoo.com.ar> wrote:

> En Tue, 27 May 2008 11:52:25 -0300, David C. Ullrich  
> <dullrich at sprynet.com> escribió:
> 
> > Oh. Never mind the details, let's just say that having 2.3 and
> > 2.5 installed on the same machine can lead to confusion
> > about exactly which one you're running a script under.
> > Duh.
> 
> You might change the prompt; put these lines in your sitecustomize.py (or  
> create it if you don't have one):
> 
> import sys
> sys.ps1 = 'p23> '
> sys.ps2 = ' ... '

Thanks. I guess I should have included details that I thought
would be of no interest to save people time with replies.

The problem is that on the Mac in question Terminal thinks
python is 2.5 (as does Idle) while when I double-click on a
file in Finder it runs under python 2.3. In particular it
never happens that I'm running an interactive session under
2.3.

(No, I'm not saying that's a good setup - it's a mess. The
other Mac, at the office, is not such a mess, but I never
could get things like Idle to work under the Apple Python...)

> > Sorry. Thanks. I don't suppose that decorators are available
> > from __future__ somehow in 2.3?
> 
> No. But a decorator is only syntax sugar.
> 
> @decorator
> def f():
>    ...
> 
> is the same thing as:
> 
> def f():
>    ...
> f = decorator(f)
> 
> (just more convenient)

-- 
David C. Ullrich



More information about the Python-list mailing list