[Python-Dev] PEP 318: Let's not give in to FUD

Barry Warsaw barry at python.org
Fri Apr 2 08:24:43 EST 2004

On Thu, 2004-04-01 at 23:28, Jeremy Hylton wrote:
> On Thu, 2004-04-01 at 22:34, Greg Ewing wrote:
> > Another thought about:
> > 
> >   [decorator]
> >   def foo(args):
> >     ...
> > 
> > What are newcomers going to make of this?
> > 
> > It looks like a thrown-away list followed by a def, and
> > there's no clue that there's any connection between the
> > two. 
> I think it's obvious that there's a connection between the two.  A bare
> list by itself would be nonsense and the actual list would probably say
> something like [classmethod] which suggests it's saying something about
> a method.

It may be nonsense, but it means something today.  So it can't be
obvious that they're connected because today, they aren't.

If tomorrow this same code means something different, users looking at
the code will have to know what version of Python they're using, and
make sure it's the right one ("uh, how do I do that?").  If they were to
use decorator-before-def code in an older version of Python, the program
would be accepted but silently do the wrong thing.

At least with decorator-before-colon trying to run the code in older
interpreters will barf loudly.


More information about the Python-Dev mailing list