[Python-3000] Stackable Blocks

Crutcher Dunnavant crutcher at gmail.com
Mon Apr 24 03:56:26 CEST 2006


On 4/23/06, Jay Parlar <jparlar at cogeco.ca> wrote:
>
> On Apr 23, 2006, at 6:32 PM, Crutcher Dunnavant wrote:
>
> > On 4/23/06, Jay Parlar <jparlar at cogeco.ca> wrote:
> >>
> >> I think what Ivan meant is that the normal Python rule is that if you
> >> have a full-colon (ANYWHERE), and you put something after it on the
> >> same line, then you're done the block. This behaviour is the same for
> >> method definitions, IF-blocks, the FOR statement, class definitions,
> >> etc.
> >>
> >> However, your change would be an exception to the rule, in that it
> >> would change what a full-colon is allowed to do, but only in one
> >> place.
> >
> > No, it wouldn't. First, this would apply to method and class defs as
> > well, so it's not an exception, secondly, the 'block ending thing
> > after the colon' would be _extended_ to cover other block defs.
> >
>
> What's the use case for doing this with method and class defs?

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):
    ...

--
Crutcher Dunnavant <crutcher at gmail.com>
littlelanguages.com
monket.samedi-studios.com


More information about the Python-3000 mailing list