[Python-ideas] Transportable indent level markers. >>>===<<<
Ron Adam
ron3200 at gmail.com
Thu Dec 15 02:08:19 CET 2011
On Wed, 2011-12-14 at 18:53 -0500, Terry Reedy wrote:
> On 12/13/2011 10:53 AM, Guido van Rossum wrote:
> > On Mon, Dec 12, 2011 at 9:24 PM, Terry Reedy<tjreedy at udel.edu> wrote:
> >> On 12/12/2011 5:07 PM, Ron Adam wrote:
> >>
> >>> To make that work, we need to use unique character sequences that aren't
> >>> already used. After some thought, I came up with these indent-markers.
> >>>
> >>> /// # indent level +1
> >>> ;;; # indent level +0
> >>> \\\ # indent level -1
>
> My objection to these is that the interpretation is arbitrary; I happen
> to read them the wrong way.
>
> >>
> >>
> >>>>>
> >> ===
> >> <<<
> >> would work even better ;-).
> >
> > No they wouldn't, these are too similar to the markers left behind by
> > merge tools for unmergable sections. Those markers were chosen because
> > they are unlikely to occur in regular code. Let's keep it that way.
> > :-)
>
> Funny. I choose them for the same reason. >>> is also bad because some
> mail agents, like Thunderbird not only interpret initial runs of > as
> message quotes but replace them with various colored bars. So if this
> were a serious idea, I would propose something else like
> ->|
> -|-
> |<-
> But a moot point unless we actually do want a standardized transport
> encoding for indents and dedents.
I think if there is enough interest in it, it could be done.
It only changes the pre-tokenized representation of the language. To do
braces correctly, it would require much deeper changes.
My choices are based on both easy visibility and also what be nice for
single line input. The ';;;' is consistent with the ';' in places where
it is used. Triple characters are easier to type than odd sequences.
I suppose I'd switch the slashes though so they follow the top down flow
better.
;;; def acc(n): # indent +0
\\\ s = n # indent +1
;;; def add(i): # indent +0
\\\ nonlocal s # indent +1
;;; s += i # indent +0
;;; return s # indent +0
/// return add # indent -1
cheers,
Ron
More information about the Python-ideas
mailing list