[Python-3000] Stackable Blocks
Jay Parlar
jparlar at cogeco.ca
Mon Apr 24 07:16:10 CEST 2006
On Apr 23, 2006, at 6:56 PM, Crutcher Dunnavant wrote:
>>
>
> They're blocks, what would be the use case for having the
> for/while/with/if stuff be treated different from class/def ? Besides,
> it comes up in platform handling code.
>
> if sys.platform == 'foo': class Bar:
> ...
>
> class Foo:
> if sys.platform == 'foo': def bar(self):
> ...
>
> else: def bar(self):
> ...
>
That's (IMHO) gross to look at. Too much information on one line
(especially your sys.platform example). The indent will be all off:
class Foo:
if sys.platform == 'foo': def bar(self):
do stuff
Having the method name physically further to the right than the method
body just doesn't feel Pythonic. The nice thing about indenting is that
everything likes up how you'd except it, quick glance and you know
what's what.
Jay P.
More information about the Python-3000
mailing list