Python Rocks! - get rid of colons

Mark Jackson mjackson at wc.eso.mc.xerox.com
Thu Jan 20 16:01:12 EST 2000


"tye4" <tye4 at yahoo.com> writes:
> 
> I have Python installed on Linux Redhat 6.0. Does anyone know where the
> source code for the compiler is located (any .tar file?). I intend to modify
> the language's syntax to add
> 'end' delimiters for the blocks.
> And since Python is copyrighted, I don't intend to flood out versions to
> anyone else... strictly for personal use.
> 
> class TestNew
> 
>     def foo(s):
>         for i in range(0, 10):
>             print i,
>         end loop
> 
>         if i == 10:
>             print 'internal error'
>         end if
> 
>         while i < 10:
>             print i
>         end loop
>     end def
> 
> end class

If you use a slightly variant spelling you'll find that the stock
Python compiler will recompile itself on the fly:

[don't forget the colon]
             |
             V
class TestNew:

    def foo(s):
        for i in range(0, 10):
            print i,
        #nd loop

        if i == 10:
            print 'internal error'
        #nd if

        while i < 10:
            print i
        #nd loop
    #nd def

#nd class

-- 
Mark Jackson - http://www.alumni.caltech.edu/~mjackson
    Faced with the choice between changing one's mind and proving
    there is no need to do so, almost everybody gets busy on the proof.
				- John Kenneth Galbraith





More information about the Python-list mailing list