Guido sees the light: PEP 8 updated

Chris Angelico rosuav at gmail.com
Tue Apr 19 23:41:59 EDT 2016


On Wed, Apr 20, 2016 at 1:23 PM, Terry Reedy <tjreedy at udel.edu> wrote:
>> It kinda looks like Hypertalk syntax, which some of you may remember I'm
>> exceedingly fond of. There's no reason why a GUI editor couldn't display
>> Python code using such "building block" structure. E.g. indented blocks
>> could use colour and shape cues to reinforce the structure of the code,
>> just as Scratch does.
>
>
> That is an interesting idea.  Perhaps I have been stuck in either/or
> thinking -- either graphical or textual. With tk Text (IDLE), it would be
> possible to tag each (4-space) indent with a color for the compound
> statememt keywork causing the indent.
>

Interesting indeed! Tell me if I've understood you correctly. You'd
display this code:

def func(x):
    for n in range(1, x):
        while n < x:
            if n % 2:
                n = (n + 1) * 3 / 2
            else:
                n = n * 2 + 3

with stripes of colour, with the entire first column of spaces all
tied to the "def", and then the next block of four tied to the "for",
etc? That'd be pretty cool, and a neat way to help people transfer
their skills from Scratch to Python.

(Would "else" be in the same colour as "if"? What about "elif"?)

ChrisA



More information about the Python-list mailing list