Terry J. Reedy added the comment:

Phil (and Todd): I do not know what you mean by "behaves like more like an 
actual Text Widget" and whether you are talking about internal or external 
behavior. But I know that tk does not use an immutable string to hold the text. 
There is no such thing in C. Tk might use one array of 2-byte words with a gap 
at the cursor and an auxiliary line pointer array, or it might use an array of 
line structure similar to what I did (but again with arrays rather than 
immutable strings for each line), or possibly some other structure, However we 
could only imitate the internals of tk.Text by using (deprecated) PyUNICODE 
arrays (see the array doc) and doing much more programming effort.
Re-splitting a single line over and over is too inefficient to consider for a 
repository patch. I believe your particular indexToInt with getLine makes the 
conversion O(n*n) instead of 'just' O(n), whereas keeping the line in split 
form makes it O(1).

Side note, as far as I know, "re.split('\n', text)" (the r prefix is not needed 
here) does the same thing as text.split('\n'). But it is slower and harder to 
type. We don't use re when a string method does the same thing.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18226>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to