2 new comment-like characters in Python to aid development?

Diez B. Roggisch deets at nospam.web.de
Fri Mar 9 10:49:07 EST 2007


dbhbarton at googlemail.com wrote:

>> > I'm sorry I don't follow your logic. Meaningless to the interpreter,
>> > yes, meaningless to the IDE or to me, no. I "_can't_ profit from these
>> > conveniences"? Why ever not?
>>
>> Exactly, the ? is meaningless to the language itself, it's only a comment
>> sign - ...
>> ... it has nothing to do with _python_ the language, so it doesn't
>> belong there.
> 
> But # is 'only a comment sign' as well, and equally meaningless to the
> interpreter. But it's still part of the language, very very useful and
> I profit from its existence every day. 

A language has to have a comment mechanism, some even several.

But all of them are clear on how they work: they affect one line, or have a
bracket style like /* */ and thus demark clearly what they affect. Even
someone not fluent in the language in question will quickly grab what they
mean.

But the key-difference is that the comment in python has a meaning for the
interpreter - ignore this.

The ? has no meaning. It only has a meaning for an editor.

>> But for python itself, it has no meaning whatsoever, and would just be a
>> character to overread, introducing visual clutter.
> 
> If you can highlight an entire block with a single character, won't
> there be _less_ visual clutter than the current way of achieving the
> same effect with # comments?

Not in my opinion - 

# fixme
def foo():
   pass

is much more clear than a rather obscure and by the occasional beholder
maybe misinterpreted

?def foo():
   pass

> Would if I could!

Well, grab eric3, it's written in python, and teach it to do so! It's an
exercise in python then :)

It already has some features like bookmarks, shouldn't be too hard to build
upon that.

> What we're talking about here is a form of 'alternate commenting
> style'. With the IDE's cooperation it'd work on whole blocks at once,
> it would highlight without disrupting the code concerned (at least the
> way I'm envisaging it), it would be versatile (could probably be used
> for as big a variety of purposes as the # comment), and yes, it'd be
> persistent, which is how it would be different from any IDE-based
> highlighting.

I think you contradict yourself here. On the one side, you want it not
disturbing to the eye, yet it should be highlighted, so it will be directly
noticed by that same eyes.

This is why I believe that your idea by itself - the visually marking of
code parts - is a good thing, but the embedding into code is not, because
it _is_ an disturbance. And with an IDE that stores such information in
e.g. project metainformation, you can even have the persistence, without
the disturbance and without altering python.

Diez



More information about the Python-list mailing list