RE: [Python-Dev] @decorators, the PEP and the "options" out there?

[Tim Peters explaining that you don't have to crunch everything up together]
That bothers me a lot too, but because the world really isn't running out of vertical whitespace:
class MyLittleToy:
def methy1(self): print 'whee'
@staticmethod def methy2(): print 'woo'
@staticmethod def methy3(arg): for i in arg: print 'woohoo'
If the syntax does end up along these lines (and I'm expressing no opinion either way), then maybe it would be worth explicitly telling people (i.e. in PEP 8) that they ought to put a blank line before decorators to make it clear? Yes, people should figure this themselves, but they probably won't <0.5 wink>, and it does make for ugly code. Same deal for "don't do '@this @and_this @on_the_same_line'" (unless that loses it's validity). (And if some other syntax 'wins', then a guide for using that couldn't hurt, too). =Tony Meyer p.s. Anyone else have a suspicion that Anthony checked in the @decorators to 2.4a2 as a sneaky way of getting more people than normal (all them riled up ones) to download the alpha and try it out? <wink>

"Tony Meyer" <t-meyer@ihug.co.nz> wrote in message news:ECBA357DDED63B4995F5C1F5CBE5B1E86C36A8@its-xchg4.massey.ac.nz...
If the syntax does end up along these lines (and I'm expressing no opinion either way), then maybe it would be worth explicitly telling people (i.e. in PEP 8) that they ought to put a blank line before decorators to make it clear?
Does PEP 8 tell people that they should put a blank before comment lines introducing a function?
Same deal for "don't do '@this @and_this @on_the_same_line'" (unless that loses it's validity).
In PEP 8, maybe, but not the Ref Manual (unless grammatically prohibited). While uglier, this form does not stike me as being wholely different from the quasilist proposals that would spell the above [this, and_this, on_the_same_line]. Terry J. Reedy

If the syntax does end up along these lines (and I'm expressing no opinion either way), then maybe it would be worth explicitly telling people (i.e. in PEP 8) that they ought to put a blank line before decorators to make it clear?
Does PEP 8 tell people that they should put a blank before comment lines introducing a function?
No, but it tells them to *separate* methods by blank lines. So that's pretty clear guidance for where the put blank lines relative to the decorators. --Guido van Rossum (home page: http://www.python.org/~guido/)
participants (3)
-
Guido van Rossum
-
Terry Reedy
-
Tony Meyer