[Python-Dev] syntactic sugar idea for {static,class}methods

Gareth McCaughan gmccaughan@synaptics-uk.com
Wed, 13 Feb 2002 17:11:57 +0000 (GMT)

Michael Hudson wrote (replying to Barry Warsaw):

> > Very interesting!  Why the square brackets though?  Is that just for
> > visual offset or is there a grammar constraint that requires them?
> Um, no big reason; they were what Gareth suggested, so I implemented
> that.  He may have got the idea from the slides from one of Guido's
> presentations -- it was reading them that reminded me I'd done this
> and wanted to mention it here.

Four reasons for the brackets.

1. Easier for the parser, I think.
2. Visually distinctive.
3. For me, it "reads" better than it would without the brackets.
4. Generalizes to a sequence of transformations.

#4 is much the most important of these in my mind.

One drawback of allowing an arbitrary list of transformations
is that it might not be completely clear what order they're done in.
I conjecture that most people will have the same intuition
as I do about this, namely that the first-listed transformation
is applied first. (It would be less obvious if the list came
before the name of the definiendum instead of after.)

Oh, and for the record: My suggestion was made long before I
ever saw Guido's slides. :-)

Gareth McCaughan