Python scoping

Andrew Kuchling akuchlin at mems-exchange.org
Wed Nov 1 11:40:42 EST 2000


-$Paul$- at verence.demon.co.uk (Paul Wright) writes:
> >Should there ever come around a programming language similar to python
> >but with braces or a begin/end, then python will be gone. The volume of
> 
> As others have said, there's nothing stopping you from trying this.
> Personally, I wouldn't see the point in such a language and wouldn't use
> it.

Yes, it should be quite simple to dive into the parser and change this.  
The relevant grammar rule would be this one:  
  suite: simple_stmt | NEWLINE INDENT stmt+ DEDENT                                

Simply change the tokenizer to return INDENT for 'begin' and DEDENT
for 'end', and now you have a version of Python that uses Pascal-style
delimeters.  I keep meaning to try this as a quick hack some day.
That no one has actually bothered to do this yet speaks volumes. 

--amk



More information about the Python-list mailing list