[issue6786] readline and zero based indexing
Éric Araujo mer...@netwok.org added the comment: I'd be writing a patch which would allow a programmer the option to explicitly use/instantiate the library in a zero-based way. [...] Would this be reasonable? I think not. Mark already stated his opposition to “a crazy level of micro control”. Such a patch would not be trivial but would not bring much. I hope you’ll find other bugs that motivate you for a patch! :) -- nosy: +eric.araujo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6786 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6786] readline and zero based indexing
James purplei...@gmail.com added the comment: I'd be writing a patch which would allow a programmer the option to explicitly use/instantiate the library in a zero-based way. This way throughout their particular program, the indexing of elements could be consistent. Not having this causes you to have to reason differently about which parts should be list[i+1] versions list[i]. Would this be reasonable? Thanks, _J -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6786 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6786] readline and zero based indexing
Terry J. Reedy tjre...@udel.edu added the comment: I do not see a change as being accepted. It would not add any new function but probably break code, if not habits, for the sake of consistency that would have been nice. -- resolution: - rejected status: open - closed versions: -Python 2.7, Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6786 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6786] readline and zero based indexing
James purplei...@gmail.com added the comment: It's an incompatible change; it would definitely break my code, however I think it should be wishlisted for an API-break release like 3.5 or 4.0 or something like that. IMHO, the bindings should be pythonic, even if the underlying library isn't. In addition, maybe we could add a readline.set_zero_based_indexing() function? I could write a patch for this perhaps... -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6786 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6786] readline and zero based indexing
Mark Dickinson dicki...@gmail.com added the comment: A patch would be useful: I don't think this issue is going to go anywhere without one. One of the reasons I'm reluctant to mess with the readline module more than necessary is that it's historically been fairly fragile: it has to work not only with a number of different GNU readline versions, but also with libedit on OS X and BSD (and OS X universal builds add an extra layer of complexity), and there have been a number of readline-related build problems in the past. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6786 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6786] readline and zero based indexing
Mark Dickinson dicki...@gmail.com added the comment: Postscript: I'm also opposed to the idea of 'optional' zero-based indexing. This just seems like a crazy level of micro control to me. Better to have just the one way way to do it, even if it isn't quite pythonic. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6786 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6786] readline and zero based indexing
Terry J. Reedy tjre...@udel.edu added the comment: I wonder if changing the base now would cause problems. Is readline only used interactively? -- versions: +Python 2.7, Python 3.1, Python 3.2 -Python 2.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6786 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6786] readline and zero based indexing
Mark Dickinson dicki...@gmail.com added the comment: Changing to feature request: I'm fairly certain that this isn't a bug (i.e., it's working as designed). It's possible to use the readline module non-interactively, so it's probably a safe bet that there's at least some code out there that does so. I'd vote to reject this; I agree it would have been nicer if indexing had started from 0 originally, but the 1-based indexing doesn't really seem like a big deal. -- type: behavior - feature request ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6786 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6786] readline and zero based indexing
James purplei...@gmail.com added the comment: @mark: thanks for the comment; i suppose we should investigate why and if c readline is 1 based... -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6786 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6786] readline and zero based indexing
James purplei...@gmail.com added the comment: i found this: http://tiswww.case.edu/php/chet/readline/history.html search for: Variable: int history_base perhaps we can set this to 0 in the python bindings. more so, perhaps someone is using 1 because they made a mistake? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6786 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6786] readline and zero based indexing
Mark Dickinson dicki...@gmail.com added the comment: I'd guess the same. Most of the readline module is just a thin wrapper around the system readline library, so if the system readline library uses one-based indexing, so does the readline module. Changing this would probably be quite error-prone, with a high chance of introducing off-by- one errors somewhere along the line. Interestingly, the Apple-supplied python (2.6.1) in OS X 10.6 does have zero-based readline history. See issue 6872. -- nosy: +marketdickinson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6786 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6786] readline and zero based indexing
Terry J. Reedy tjre...@udel.edu added the comment: Please ask questions on, for instance, the python-list (c.l.p). If you find evidence that this is actually a bug, please supply. Else, close (or change to doc issue -- see below). My *guess* is that history lists are 1-based and Python conforms to that. If so, the doc should mention that. But I do not know. -- nosy: +tjreedy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6786 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6786] readline and zero based indexing
New submission from James purplei...@gmail.com: why is it that the zeroth readline history item is seemingly always none. I would expect this to support zero-based indexing in python, but perhaps I have missed some detail in readline somewhere. Cheers, _J ja...@work:~$ python Python 2.5.2 (r252:60911, Oct 5 2008, 19:24:49) [GCC 4.3.2] on linux2 Type help, copyright, credits or license for more information. import readline readline.get_history_item(0) readline.get_history_item(0) is None True ja...@work:~$ -- components: Extension Modules messages: 91979 nosy: purpleidea severity: normal status: open title: readline and zero based indexing type: behavior versions: Python 2.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6786 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com