[Python-Dev] Re: Decorators: vertical bar syntax

Fernando Perez fperez528 at yahoo.com
Mon Aug 9 19:33:59 CEST 2004


Paul Moore wrote:

> Fernando Perez <fperez528 at yahoo.com> writes:
[...]
> But we have a couple of inconsistencies to backtrack and resolve. (And
> the accepts/returns stuff is also inconsistent, but I'll stop picking
> holes in what is clearly just an example...)
> 
> I'm not saying that the same issues mightn't exist with the
> decorator-before-def form, but I don't think the mental model for the
> decorator-after-def form is quite as clean as you'd like either...

Well, I'm not so naive as to think that there is a silver bullet here or a
perfect syntax.  Obviously in all cases the programmer will need to keep some
context in his head.  But this is true always:

x = 1

... many lines of code which can't change x in any way

x.append('foo')  # BUG!

You spot something like this because you have a notion of local context, and
you remember that x, being an integer which hasn't changed, can't be appended
to as a list.

In fact, I'd argue that one of (not the only one) the key qualities of a good
programmer is the ability to maintain a fair amount of local and global
context in his head.  This is what allows you to realize the implications of a
code change, see the potential for fruitful refactorings, etc.

But that doesn't mean that one syntax choice can't make that process _easier_. 
It doesn't remove the need for having one's brain turned on, it is not a
silver bullet, but it enhances the flow of processing this kind of information
into an organized structure.

> It's still subjective :-)

I disagree, and I think I've given detailed arguments trying _precisely_ to
cast this discussion in terms which are potentially more productive than 'its
all subjective', which lead to endless running in circles.  I very much
appreciate a discussion of the merits of my ideas, but hopefully in terms
which allow something which goes beyond "your shirt is blue, and I don't like
blue".  I've tried to reply here in such a vein, hoping to produce useful
arguments for Guido and those ultimately making the decisions.

Yes, there is always a degree of subjectivity in all choices, and in that sense
I immensely trust Guido's intuition, ability and sense of aesthetics.  But
one's subjectivity works best when assisted by other arguments as well.

Best,

f



More information about the Python-Dev mailing list