Re: Highlighting program variables instead of keywords?

2014-01-29 Thread Piet van Oostrum
Ned Batchelder n...@nedbatchelder.com writes:

 On 1/28/14 2:19 AM, wxjmfa...@gmail.com wrote:
 Different, but a little bit related. The work
 which is done actually on the possibility (not
 implemented but alreay realized) to colorize (style)
 the different graphemes of a glyph is very interesting.

 Python with its absurd Flexible String Representation
 just become a no go for the kind of task.

 (Should not be too complicate to understand.)

 jmf


 JMF, seriously, stop it.  You've convinced no one because you have no
 convincing arguments.

 It's obnoxious to continue to make this claim.  Stop it.  Please.

 If you want to try to convince someone, convince me.  Write to me
 offline: n...@nedbatchelder.com

 -- 
 Ned Batchelder, http://nedbatchelder.com


I seriously think jmf has a mental disorder. So these reactions won't do 
anything useful. Just ignore.
-- 
Piet van Oostrum p...@vanoostrum.org
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Highlighting program variables instead of keywords?

2014-01-28 Thread Mark Lawrence

On 28/01/2014 07:19, wxjmfa...@gmail.com wrote:

Different, but a little bit related. The work
which is done actually on the possibility (not
implemented but alreay realized) to colorize (style)
the different graphemes of a glyph is very interesting.

Python with its absurd Flexible String Representation
just become a no go for the kind of task.

(Should not be too complicate to understand.)

jmf



This guy has surely exceeded his three strikes and you're out limit? 
Please, please somebody do something about it, he's driving me insane 
with this continuous drivel.  No thread appears to be safe from him 
jumping in with this nonsense.


--
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.


Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list


Re: Highlighting program variables instead of keywords?

2014-01-28 Thread Steven D'Aprano
On Mon, 27 Jan 2014 23:19:03 -0800, wxjmfauth wrote:

 Different, but a little bit related. The work which is done actually on
 the possibility (not implemented but alreay realized) to colorize
 (style) the different graphemes of a glyph is very interesting.
 
 Python with its absurd Flexible String Representation just become a no
 go for the kind of task.
 
 (Should not be too complicate to understand.)

No, not complicated at all. 

Water is wet, therefore the FSR is rubbish.

Athens is the capital of Greece, therefor the FSR is rubbish.

1+1 = 2, therefore the FSR is rubbish.

The South American Potoo is a member of the Nyctibiidae family, therefore 
the FSR is rubbish.

We get the point, thank you.


-- 
Steven
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Highlighting program variables instead of keywords?

2014-01-28 Thread Ned Batchelder

On 1/28/14 2:19 AM, wxjmfa...@gmail.com wrote:

Different, but a little bit related. The work
which is done actually on the possibility (not
implemented but alreay realized) to colorize (style)
the different graphemes of a glyph is very interesting.

Python with its absurd Flexible String Representation
just become a no go for the kind of task.

(Should not be too complicate to understand.)

jmf



JMF, seriously, stop it.  You've convinced no one because you have no 
convincing arguments.


It's obnoxious to continue to make this claim.  Stop it.  Please.

If you want to try to convince someone, convince me.  Write to me 
offline: n...@nedbatchelder.com


--
Ned Batchelder, http://nedbatchelder.com

--
https://mail.python.org/mailman/listinfo/python-list


Re: Highlighting program variables instead of keywords?

2014-01-28 Thread Michael Torrie
On 01/28/2014 12:38 PM, Ned Batchelder wrote:
 JMF, seriously, stop it.  You've convinced no one because you have no 
 convincing arguments.
 
 It's obnoxious to continue to make this claim.  Stop it.  Please.
 
 If you want to try to convince someone, convince me.  Write to me 
 offline: n...@nedbatchelder.com

JMF, maybe if you'd actually try to write a program in Python that does
what you are talking about with colorizing graphemes, (whatever that
means) then you can talk.  Sounds to me like you don't even use Python
at all, for unicode or anything else.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Highlighting program variables instead of keywords?

2014-01-27 Thread Lele Gaifax
Skip Montanaro s...@pobox.com writes:

 I think this might have value, especially if to could bounce back and forth
 between both schemes. Is anyone aware of tools like this for Python? Bonus
 points for pointers to an Emacs implementation.

There has been a recent thread on some emacs group about this. Dunno how
far it has gone wrt Python support, but the following mode appeared in
MELPA archives in the last couple of days:

  https://github.com/ankurdave/color-identifiers-mode

hth, ciao, lele.
-- 
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
l...@metapensiero.it  | -- Fortunato Depero, 1929.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Highlighting program variables instead of keywords?

2014-01-27 Thread Mark Lawrence

On 27/01/2014 01:46, Skip Montanaro wrote:

What it is doing is color coding user-supplied identifiers, with different
color for each one. I found that confusing to read.


I think it would take some time to get used to, and I don't think it
would be the only way I'd like to view my program.

I think an interactive pylint (or pyflakes or frosty) type capability
would be useful, highlighting a subset of the messages it produces,
like variables which were assigned but never used, or using undefined
variables. It might be best supported by actually running the checker
in the background, then using its messages to direct where to
highlight suspect bits of code.

Skip



Pydev uses pylint interactively, must have saved me hours by flagging up 
(potential) problems up as I type.


--
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.


Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list


Re: Highlighting program variables instead of keywords?

2014-01-27 Thread Ethan Furman

On 01/26/2014 06:54 PM, Roy Smith wrote:

Chris Angelico wrote:


That said, though, I grew up without syntax highlighting of any sort,
and didn't think it particularly important; but now that I have
editors with all those sorts of features, I do find them handy.


Same here, except I'd replace find them handy with totally addicted
to.


+1000

--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list


Re: Highlighting program variables instead of keywords?

2014-01-27 Thread Vito De Tullio
Skip Montanaro wrote:

 My son sent me a link to an essay about highlighting program data instead
 of keywords:
 
 https://medium.com/p/3a6db2743a1e/
 
 I think this might have value, especially if to could bounce back and
 forth between both schemes. Is anyone aware of tools like this for Python?

AFAIK kdevelop support this.

http://kdevelop.org/sites/kdevelop.org/files/photos/kdev_python_1.png


-- 
By ZeD

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Highlighting program variables instead of keywords?

2014-01-27 Thread wxjmfauth
Different, but a little bit related. The work
which is done actually on the possibility (not
implemented but alreay realized) to colorize (style)
the different graphemes of a glyph is very interesting.

Python with its absurd Flexible String Representation
just become a no go for the kind of task.

(Should not be too complicate to understand.)

jmf

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Highlighting program variables instead of keywords?

2014-01-26 Thread Terry Reedy

On 1/26/2014 7:31 PM, Skip Montanaro wrote:

My son sent me a link to an essay about highlighting program data
instead of keywords:

https://medium.com/p/3a6db2743a1e/


What it is doing is color coding user-supplied identifiers, with 
different color for each one. I found that confusing to read. The only 
use I can see for this is to track the usage of a particular name, but 
that would be better done by just highlighting one name at a time.



I think this might have value, especially if to could bounce back and
forth between both schemes. Is anyone aware of tools like this for
Python? Bonus points for pointers to an Emacs implementation.


--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list


Re: Highlighting program variables instead of keywords?

2014-01-26 Thread Chris Angelico
On Mon, Jan 27, 2014 at 11:46 AM, Terry Reedy tjre...@udel.edu wrote:
 The only use I can see for this is to track the usage of a particular name,
 but that would be better done by just highlighting one name at a time.

In SciTE, I can put the cursor on a word and hit Ctrl-F3 to find other
instances of that word. If that's not enough, following it up with
Ctrl-Home, F3 will find the first instance of it, and if the program
follows the Define-Before-Use principle, that'll be the definition.
That's usually enough.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Highlighting program variables instead of keywords?

2014-01-26 Thread Chris Angelico
On Mon, Jan 27, 2014 at 11:51 AM, Chris Angelico ros...@gmail.com wrote:
 On Mon, Jan 27, 2014 at 11:46 AM, Terry Reedy tjre...@udel.edu wrote:
 The only use I can see for this is to track the usage of a particular name,
 but that would be better done by just highlighting one name at a time.

 In SciTE, I can put the cursor on a word and hit Ctrl-F3 to find other
 instances of that word. If that's not enough, following it up with
 Ctrl-Home, F3 will find the first instance of it, and if the program
 follows the Define-Before-Use principle, that'll be the definition.
 That's usually enough.

 ChrisA

That said, though, I grew up without syntax highlighting of any sort,
and didn't think it particularly important; but now that I have
editors with all those sorts of features, I do find them handy. So
it's possible that a system like this would be of value if once the
programmer gets used to it.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Highlighting program variables instead of keywords?

2014-01-26 Thread Steven D'Aprano
On Sun, 26 Jan 2014 18:31:49 -0600, Skip Montanaro wrote:

 My son sent me a link to an essay about highlighting program data
 instead of keywords:
 
 https://medium.com/p/3a6db2743a1e/
 
 I think this might have value, especially if to could bounce back and
 forth between both schemes.

Hmmm, I'm not convinced, but then I wasn't convinced by syntax 
highlighting either until I had used it for a while. (I still think it's 
a nice-to-have rather than a must-have.)

Seems to me that beyond a dozen or so variables, the colours won't be 
distinctive enough to get much benefit. Especially if similar names get 
similar colours, e.g. the name handle_process and the typo 
handle_prosess will be barely distinguishable. In a well-designed 
program, most variables will appear in a fairly limited number of places, 
possibly in only a single function or method, so in even a fairly small 
project you might have a few dozen distinct variables, each of which 
might appear only three or five times.



 Is anyone aware of tools like this for
 Python? Bonus points for pointers to an Emacs implementation.

Sorry, can't help you.


-- 
Steven
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Highlighting program variables instead of keywords?

2014-01-26 Thread Chris Angelico
On Mon, Jan 27, 2014 at 12:29 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
 Hmmm, I'm not convinced, but then I wasn't convinced by syntax
 highlighting either until I had used it for a while. (I still think it's
 a nice-to-have rather than a must-have.)

It's definitely just a nice-to-have. I've built miniature text editors
into various programs (including two MUD clients, for the purpose of
editing files on the server), and haven't bothered with the level of
sophistication required for smart-indent, much less syntax
highlighting. (I'll occasionally put in an auto-indent - hit enter and
it indents to the same level as the previous line - but not even
always that, and definitely not hey, that line has more ( than ) so
I'll indent an extra level, which is a *hugely* helpful feature when
I'm doing main coding (it catches errors, as well as saving time on
indentation), but one I can do without if it means I can knock
together an editor in a tenth the time.)

 Seems to me that beyond a dozen or so variables, the colours won't be
 distinctive enough to get much benefit. Especially if similar names get
 similar colours, e.g. the name handle_process and the typo
 handle_prosess will be barely distinguishable. In a well-designed
 program, most variables will appear in a fairly limited number of places,
 possibly in only a single function or method, so in even a fairly small
 project you might have a few dozen distinct variables, each of which
 might appear only three or five times.

Hmm. Would similar names get similar colours? I would guess that a
naive approach would just go sequentially through the file, but if
it's smart enough to recognize similarity, it'd be nice if it could
then be smart enough to make them contrast. The more similar the
words, the less similar the colours, and vice versa. Or at very least,
sort all the words alphabetically, and then distribute them in some
binary flip-flop method that will tend to put the ones with the same
start further apart. (That would catch typos anywhere other than the
beginning of the name.)

Oh. Yes, they will get similar colours. Just re-read the page:

Variable names with similar prefixes will be assigned similar colors.
We collect all the custom names and order them alphabetically, then
distributing them evenly along a spectrum. This way we make sure we
use as distinct colors as possible.

IMO this is a flawed design decision. The purpose of the color is to
add information, not to replicate what's already there. (And it's
using the simplistic method I described, of simply sorting
alphabetically to determine similarity. There are other ways of
distinguishing, but they're a lot more complicated.)

If it's smart enough to recognize the difference between local and
global names, that would be useful. Might not be so useful in JS, but
definitely in Python. It would take a bit of smartness, but most
editors these days have to be able to fully parse the language anyway.
Hmm. Actually, this might be a plausible idea just on its own: never
mind about distinguishing specific names, just create a highlight
class for each of local name (including function parameters),
global name, read-only, and global name, assigned to in this
function, and possibly non-local (read-only and assigned) as well. If
you suddenly see that the name 'len' has changed from being global
name, read-only to local name, you'll know instantly that you just
shadowed a built-in (probably unintentionally and in a way likely to
cause bugs). Do any editors currently offer this?

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Highlighting program variables instead of keywords?

2014-01-26 Thread Skip Montanaro
 What it is doing is color coding user-supplied identifiers, with different
 color for each one. I found that confusing to read.

I think it would take some time to get used to, and I don't think it
would be the only way I'd like to view my program.

I think an interactive pylint (or pyflakes or frosty) type capability
would be useful, highlighting a subset of the messages it produces,
like variables which were assigned but never used, or using undefined
variables. It might be best supported by actually running the checker
in the background, then using its messages to direct where to
highlight suspect bits of code.

Skip
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Highlighting program variables instead of keywords?

2014-01-26 Thread Ben Finney
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info writes:

 Hmmm, I'm not convinced, but then I wasn't convinced by syntax
 highlighting either until I had used it for a while. (I still think
 it's a nice-to-have rather than a must-have.)

I wouldn't rate syntax highlighting a must-have. But I do think it's
significantly more difficult to work with an editor that doesn't
highlight the syntax of the code.

 Seems to me that beyond a dozen or so variables, the colours won't be 
 distinctive enough to get much benefit.

A more severe problem with the suggestion is that human cognition is
only capable of attending to a limited number of differences at once,
and so this kind of attention-drawing is a limited resource. Drawing
attention to some aspects is at the expense of reduced attention to
other aspects.

The significant benefit of syntax highlighting is that it reduces the
difficulty to read the text and see what will be obvious to the
compiler: the structure of each statement and block. So spending the
limited resource of differential attention to colours is valuable to
help with this difficult aspect of reading code.

So I strongly disagree with the statement “But as it stands, we
highlight the obvious (like the word function) and leave most of the
content in black.”

Once you have attention on it, the word “function” is obvious. But the
whole motivation of highlighting syntax using different colours is to
get that differential attention in the first place. The difference
between tokens *isn't* so obvious when glancing at the code without
those colours.

That said, the motivation in highlighting different names differently is
a good one, too. I would like to have the benefit described in the
article: having different names easily distinguished in the code. But I
don't think that should come at the expense of significantly reducing
the ease of quickly distinguishing the syntactical structure.

-- 
 \   “We must find our way to a time when faith, without evidence, |
  `\disgraces anyone who would claim it.” —Sam Harris, _The End of |
_o__) Faith_, 2004 |
Ben Finney

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Highlighting program variables instead of keywords?

2014-01-26 Thread Roy Smith
In article mailman.6011.1390783954.18130.python-l...@python.org,
 Chris Angelico ros...@gmail.com wrote:

 That said, though, I grew up without syntax highlighting of any sort,
 and didn't think it particularly important; but now that I have
 editors with all those sorts of features, I do find them handy.

Same here, except I'd replace find them handy with totally addicted 
to.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Highlighting program variables instead of keywords?

2014-01-26 Thread Terry Reedy

On 1/26/2014 8:29 PM, Steven D'Aprano wrote:

On Sun, 26 Jan 2014 18:31:49 -0600, Skip Montanaro wrote:


My son sent me a link to an essay about highlighting program data
instead of keywords:

https://medium.com/p/3a6db2743a1e/

I think this might have value, especially if to could bounce back and
forth between both schemes.


Hmmm, I'm not convinced, but then I wasn't convinced by syntax
highlighting either until I had used it for a while. (I still think it's
a nice-to-have rather than a must-have.)


When my fingers get a bit fumbly, I find it more useful. When I do not 
hit ' or  solidly, or  type a mismatch 'something, having the string 
literal color continue is a handy clue. So is 'it' not getting the 
keyword color that if would.


--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list


Re: Highlighting program variables instead of keywords?

2014-01-26 Thread Terry Reedy

On 1/26/2014 8:46 PM, Skip Montanaro wrote:


I think an interactive pylint (or pyflakes or frosty) type capability
would be useful, highlighting a subset of the messages it produces,
like variables which were assigned but never used, or using undefined
variables. It might be best supported by actually running the checker
in the background, then using its messages to direct where to
highlight suspect bits of code.


One of my long-term goals for Idle is an extension that would run 
user-installed code analyzers over the contents of an edit window, with 
the output sent to an OutputWindow. Using the contents of the latter to 
mark things in the editor window is an interesting idea. That is already 
done for SyntaxErrors and traceback file:line references.


--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list