[issue5845] rlcompleter should be enabled automatically

2014-04-12 Thread R. David Murray

R. David Murray added the comment:

This issue should have gone back to being a release blocker after the alpha 
release to fix the tab-as-indent issue, but obviously that didn't happen (I 
forgot about it myself).  Please open a new issue requesting a fix for this bug 
(that tab doesn't work as indent at the ... prompt), referencing the discussion 
in this issue.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2014-04-08 Thread David Beazley

David Beazley added the comment:

Funny thing, this feature breaks the interactive interpreter in the most basic 
way on OS X systems.   For example, the tab key won't even work to indent.  You 
can't even type the most basic programs into the interactive interpreter. For 
example:

 for i in range(10):
...  print(i)

Oh sure, you can make it work by typing the space bar a bunch of times, but 
it's extremely annoying.  

The only way I was able to get a working interactive interpreter on my machine 
was to manually edit site.py and remove the call to enablerlcompleter() from 
main().

I hope someone reconsiders this feature and removes it as default behavior.

--
nosy: +dabeaz

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2014-03-09 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 69c451851c71 by R David Murray in branch 'default':
whatsnew: sys.__interactivehook__. (#5845)
http://hg.python.org/cpython/rev/69c451851c71

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2014-01-27 Thread Jason R. Coombs

Jason R. Coombs added the comment:

Added issue20411, revealed in 3.4b2.

--
nosy: +jason.coombs

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2013-12-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

What is the status of this issue?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2013-12-08 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I would say it's now closed. If there's some fine tuning needed, separate 
issues should be opened.

--
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2013-09-29 Thread Xavier de Gaye

Xavier de Gaye added the comment:

There is a backward compatibility issue with changeset d5ef330bac50
that enables tab-completion in the interactive interpreter by default.

When a user is not aware of this new feature and has been implementing
up to now her/his PYTHONSTARTUP file with the first example given in
python 3.3 documentation at

http://docs.python.org/3/library/readline.html?highlight=readline#example

then each new interactive python 3.4 session reads (appending them)
both history files which are saved on exit. Thus those files double
their size after each interactive python 3.4 session and pretty soon
become few mega bytes long with a python start up time that becomes
quite noticeable.

--
nosy: +xdegaye

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2013-09-29 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 When a user is not aware of this new feature and has been implementing
 up to now her/his PYTHONSTARTUP file with the first example given in
 python 3.3 documentation at
 
 http://docs.python.org/3/library/readline.html?highlight=readline#example
 
 then each new interactive python 3.4 session reads (appending them)
 both history files which are saved on exit. Thus those files double
 their size after each interactive python 3.4 session and pretty soon
 become few mega bytes long with a python start up time that becomes
 quite noticeable.

Interesting. A way to avoid doing this would be to only load history if
no history is already present. Since the sys.__interactivehook__ is
executed after PYTHONSTARTUP, this would allow the latter to take
precedence.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2013-09-29 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Attaching patch to only load history file if no history exists.

--
keywords:  -needs review
resolution:  - fixed
Added file: http://bugs.python.org/file31914/rl_history_guard.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2013-09-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 687dd81cee3b by Antoine Pitrou in branch 'default':
Issue #5845: In site.py, only load readline history from ~/.python_history if 
no history has been read already.  This avoids double writes to the history 
file at shutdown.
http://hg.python.org/cpython/rev/687dd81cee3b

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2013-09-29 Thread Xavier de Gaye

Xavier de Gaye added the comment:

The patch fixes the problem on my setup. A very minor glitch: after
manually emptying or removing the PYTHONSTARTUP history file, the
history is loaded with the content of ~/.python_history on the next
session.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2013-09-29 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 The patch fixes the problem on my setup. A very minor glitch: after
 manually emptying or removing the PYTHONSTARTUP history file, the
 history is loaded with the content of ~/.python_history on the next
 session.

Yes, the only way to know if a history file has already been loaded with
readline seems to be to query the history itself. So, if the history is
empty, we consider no file has been loaded.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2013-08-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Do you know that the readline module first force rebind of TAB to insert-tab?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2013-07-31 Thread Larry Hastings

Larry Hastings added the comment:

This issue seems to have stalled.  But it's still marked as a release blocker, 
which means I can't release Python 3.4a1 in two days if this issue is still 
open.

One of three things will happen:
1) This issue is marked closed.
2) This issue is downgraded from release blocker.
3) The alpha slips.

IMO the optimal solution is that tab preceded by only whitespace indents, and 
tab preceded by any non-whitespace character attempts to complete.  Can we goad 
readline into behaving this way?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2013-07-31 Thread Steven D'Aprano

Steven D'Aprano added the comment:

On 31/07/13 17:14, Larry Hastings wrote:

 IMO the optimal solution is that tab preceded by only whitespace indents, and 
 tab preceded by any non-whitespace character attempts to complete.  Can we 
 goad readline into behaving this way?

Yes we can. Attached are a pair of lightweight modules I've used for this for 
the last 3-4 years, and it works fine in Python 2.4 through 3.3. I put 
something like this in my startup.py:

import completer
import history
history = history.History()
completer = completer.Completer(
 bindings=(r'\C-xo: overwrite-mode',
   r'\C-xd: dump-functions',
  ))

Originally they were in a single class, but I was persuaded that it was cleaner 
to separate them.

--
Added file: http://bugs.python.org/file31095/completer.py
Added file: http://bugs.python.org/file31096/history.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___Command line completion.

This module relies on both the ``readline`` and ``rlcompleter`` modules.
Under Windows, you may be able to use the third-party ``pyreadline`` module
(untested).

Creating a ``Completer`` instance enables readline completion:

 completer = Completer()  #doctest: +SKIP


By default, the TAB key is used for both indenting and completion. See
the ``Completer`` class for further instructions, including how to change
this behaviour.


# Keep this module compatible with Python 2.4 and better.


# TODO: add operate and go next functionality like in bash.
# TODO: add filename completion.


try:
# Everything depends on readline.
import readline
except ImportError:
# May be Windows, so try using a substitute.
import pyreadline as readline

import rlcompleter


def using_libedit():
Return True if the underlying readline library is libedit.
# This tests for the libedit library instead of libreadline, which
# may indicate OS-X or *BSD - See http://bugs.python.org/issue10666
#
# FIXME This is the canonical test as suggested by the docs, but
# surely there is a better test than this? Perhaps something like
# sys.platform == DARWIN?
return 'libedit' in readline.__doc__


# Set up command line completion:
class Completer(rlcompleter.Completer):
Readline tab completer with optional support for indenting.

All arguments to the class constructor are optional.

namespace::
None, or a namespace dict, to use for completions. See the
``rlcompleter`` module for more details.

key::
Key to use for completion. ``key`` should be a key combination
written in the appropriate syntax for your readline library.
If ``key`` is not given or is None, the default TAB key will be
used:

* if you are using libreadline, 'tab' will be used;
* if you are using libedit, '^I' will be used.

Any other choice for ``key`` will be used exactly as given, and
it is your responsibility to ensure it is in the correct format
for the underlying readline library.

indent::
String to insert for indents when the completer key is pressed
at the start of the line. The default is to insert '\\t' (a
literal tab). Another common choice is '' (four spaces). If
you pass None or the empty string, pressing the completer key
will *not* indent.

query_items::
The maximum number of items that the completer will show without
asking first. The default is 30.

bindings::
A tuple of additional readline bindings to be parsed. As a
convenience, if you have only one binding to use, you can pass
it as a string rather than inside a tuple. See your operating
system's readline documentation for syntax.


def __init__(self, namespace=None,
# Tab completion:
key=None, indent='\t', query_items=30,
# Extra bindings to be used:
bindings=(),
):
# This is a classic class in Python 2.x, so no super().
rlcompleter.Completer.__init__(self, namespace)
self.key = key
self.indent = indent
self.query_items = query_items
if isinstance(bindings, str):
bindings = (bindings,)
self.bindings = bindings
self._enable()

def completer(self, text, state):
Completer function with optional support for indenting.

If self.indent is not empty or None, it will be used to indent at the
start of lines.

# At the start of a line, indent.
if self.indent and (text == '' or text.isspace()):
return [self.indent, None][state]
return rlcompleter.Completer.complete(self, text, state)

def set_completer(self):
Set the completer.
# Remove the previous completer 

[issue5845] rlcompleter should be enabled automatically

2013-07-31 Thread Martin v . Löwis

Martin v. Löwis added the comment:

If R. David agrees (assuming no patch is coming forward), it could be degrated 
to deferred-blocker, and the alpha phases could be used to see how annoyed 
people are with tab not working.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2013-07-31 Thread R. David Murray

R. David Murray added the comment:

Yeah, deferred blocker is fine with me.

--
priority: release blocker - deferred blocker

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2013-06-26 Thread anatoly techtonik

Changes by anatoly techtonik techto...@gmail.com:


--
nosy: +techtonik

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2013-05-06 Thread Mark Dickinson

Mark Dickinson added the comment:

On OS X 10.6, I now get the following message at interpreter startup:


iwasawa:cpython mdickinson$ ./python.exe
Python 3.4.0a0 (default:d5ef330bac50, May  6 2013, 13:05:57) 
[GCC 4.2.1 (Apple Inc. build 5664)] on darwin
Type help, copyright, credits or license for more information.
Failed calling sys.__interactivehook__
Traceback (most recent call last):
  File /Users/mdickinson/Python/cpython/Lib/site.py, line 481, in 
register_readline
readline.read_init_file()
OSError: [Errno -1] Unknown error: -1

--
nosy: +mark.dickinson

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2013-05-06 Thread Mark Dickinson

Mark Dickinson added the comment:

More information: readline.read_init_file() produced the same traceback before 
this commit, so all that's changed is that we're now calling this at 
interpreter startup.  It looks like I'm using the system libedit:

iwasawa:cpython mdickinson$ otool -L 
build/lib.macosx-10.6-x86_64-3.4-pydebug/readline.so 
build/lib.macosx-10.6-x86_64-3.4-pydebug/readline.so:
/usr/lib/libedit.2.dylib (compatibility version 2.0.0, current version 
2.11.0)
/usr/lib/libncurses.5.4.dylib (compatibility version 5.4.0, current 
version 5.4.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current 
version 125.2.11)
iwasawa:cpython mdickinson$

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2013-05-06 Thread Mark Dickinson

Mark Dickinson added the comment:

So I'm failing to find any documentation for libedit, but it looks as though 
this error occurs if rl_read_init_file fails to find an .editrc file in the 
appropriate place.  If I create an empty .editrc file in my home directory, the 
error disappears.  (Having an .inputrc file doesn't seem to make a difference 
either way.)

Perhaps the solution is to ignore an OSError from readline.read_init_file in 
register_readline---i.e., add a try / except OSError there.  The other option 
would be to ignore a nonzero errno from rl_read_init_file, but that doesn't 
sound so good: I'd expect someone deliberately calling readline.read_init_file 
to get an exception if the initialization file isn't found.

--
resolution: fixed - 
status: closed - open

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2013-05-06 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 So I'm failing to find any documentation for libedit, but it looks as
 though this error occurs if rl_read_init_file fails to find an
 .editrc file in the appropriate place.  If I create an empty .editrc
 file in my home directory, the error disappears.  (Having an
 .inputrc file doesn't seem to make a difference either way.)
 
 Perhaps the solution is to ignore an OSError from
 readline.read_init_file in register_readline---i.e., add a try /
 except OSError there.

This sounds fine to me. Can you propose a patch? I'm unlikely to ever have
an OS X machine.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2013-05-06 Thread Mark Dickinson

Mark Dickinson added the comment:

The attached fixes the issue for me.  I'm not sure whether the try / except 
should only be done on Apple, though.  What's the behaviour on Linux if there's 
no .inputrc file?

--
Added file: http://bugs.python.org/file30148/issue5845_osx_fix.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2013-05-06 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 The attached fixes the issue for me.  I'm not sure whether the try /
 except should only be done on Apple, though.  What's the behaviour
 on Linux if there's no .inputrc file?

Everything works fine under Linux (as usual :-)).
There's no need to restrict the try / except to Apple platforms, though.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2013-05-06 Thread Steven D'Aprano

Steven D'Aprano added the comment:

I'm not able to test the patch at the moment, but since it essentially just 
uses the recipe in the docs, I expect it will have the same side-effect. 
Namely, it prevents you using the tab key to indent in the interactive 
interpreter.

Now I don't know if I'm missing something painfully obvious, but having to bang 
out space-space-space-space for every indent is surely not going to be a win 
for usability ;-) Even if I am missing something, surely so will a lot of other 
users.

I use a readline completer that (in my opinion) does the Right Thing: at the 
start of the line, hitting TAB inserts a tab, otherwise it does completion. It 
also sets a history file, adds a couple of key bindings that I sometimes find 
useful, and wraps it all up in a class. (Attached.) If you think there is any 
value in this, I'm happy to update it to Python 3.3 and polish it up as a patch 
to the readline module. Or someone can just mine it for ideas.

--
Added file: http://bugs.python.org/file30149/completer.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2013-05-06 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 Now I don't know if I'm missing something painfully obvious, but
 having to bang out space-space-space-space for every indent is
 surely not going to be a win for usability ;-) Even if I am missing
 something, surely so will a lot of other users.

What *looks* painfully obvious to me is that Python doesn't force you
to use 4 spaces (or tabs) for indents :-)

 I use a readline completer that (in my opinion) does the Right Thing:
 at the start of the line, hitting TAB inserts a tab, otherwise it
 does completion. It also sets a history file, adds a couple of key
 bindings that I sometimes find useful, and wraps it all up in a
 class.

The indent at beginning of line thing sounds useful. The rest seems
to conflate the concept of a completer with the readline module itself.
Even though it's called rlcompleter, the rlcompleter module is
actually generic and could be used with other input schemes, so I don't
think it's the right place to set history options or key bindings.

In any case, you should post your patch as part of a separate issue, IMO.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2013-05-06 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 82e92da929eb by Mark Dickinson in branch 'default':
Issue #5845: avoid an exception at startup on OS X if no .editrc file exists.
http://hg.python.org/cpython/rev/82e92da929eb

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2013-05-06 Thread Mark Dickinson

Mark Dickinson added the comment:

Applied the OS X fix;  reclosing.

--
resolution:  - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2013-05-06 Thread R. David Murray

R. David Murray added the comment:

The tab-doesn't-indent still needs to be fixed before 3.4 is released.

--
nosy: +larry
priority: normal - release blocker
resolution: fixed - 
status: closed - open

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2013-05-06 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 The tab-doesn't-indent still needs to be fixed before 3.4 is
 released.

I don't really understand why this would be a release blocker?
The interpreter prompt is a convenience, we don't guarantee
compatibility like with stdlib APIs.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2013-05-06 Thread R. David Murray

R. David Murray added the comment:

It is a release blocker because it is a major usability regression.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2013-05-06 Thread R. David Murray

R. David Murray added the comment:

Just to be clear how important I consider this, I would advocate for backing 
out this patch rather than releasing 3.4 with a broken tab key at the 
interactive prompt.  But I'd rather have the patch *and* a working tab key.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2013-05-06 Thread R. David Murray

R. David Murray added the comment:

Well, post it to python-dev and see what reaction you get :)

I could be wrong, but I don't think I am (obviously).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2013-05-06 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 It is a release blocker because it is a major usability regression.

Really? You can press the space key to indent, it works as well
as the tab key...

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2013-05-06 Thread Ronald Oussoren

Ronald Oussoren added the comment:

I expect that a lot of users use the tab key to indent in the repl (as well as 
in editors, smart enough editors can convert the tab presses to spaces)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2013-05-06 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 Well, post it to python-dev and see what reaction you get :)

I'm not interested in python-dev reactions here. For this
kind of issue, we'll have hundreds of messages for and against
the change without any useful content.

The commit adds an often-requested feature (to the point that many
people were already taking the pain of activating it manually).
But, yes, we could add Steven's refinement so that all bases are
covered.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2013-05-06 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 I expect that a lot of users use the tab key to indent in the repl
 (as well as in editors, smart enough editors can convert the tab
 presses to spaces)

The interpreter prompt is not a text editor at all. You can misuse
it as one, but that's a loss of time and energy IMO.

Really, everyone I've ever showed tab-completion to has always
been enthusiastic about it (why isn't this enabled by default?).
None has ever raised the concern of being able to use the tab key
to indent code under the prompt.

(probably because noone is crazy enough to type long chunks of
code under the interactive prompt anyway)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2013-05-06 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

I am in AP's camp on the tab issue, but I think we can preserve tab inserts 
tab behavior at the continuation prompt.  I don't like indent at beginning of 
line.  I have rlcompleter enabled in Python 2.6 and i get the following when I 
press tab:

Python 2.6.6 (r266:84292, Feb 22 2013, 00:00:18)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type help, copyright, credits or license for more information.
 tab
Display all 173 possibilities? (y or n) y
ArithmeticError(abs(input(
AssertionError( all(int(
AttributeError( and intern(
BaseException(  any(is
..

I find this rather useful.

At the ... prompt, however, a tab (or better four spaces) is arguably the right 
completion at the beginning of the line.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2013-05-06 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Take it with a large grain of Internet salt, but Ezio pointed me to the 
following reactions:
http://www.reddit.com/r/Python/comments/1dq7sh/python_repl_finally_gets_tab_completion_by_default/

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2013-05-06 Thread Tshepang Lekhonkhobe

Tshepang Lekhonkhobe added the comment:

Also made it to the front-page of Hacker News[1], with better quality comments 
than the reddit thread.

[1] https://news.ycombinator.com/item?id=5658062

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2013-05-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset d5ef330bac50 by Antoine Pitrou in branch 'default':
Issue #5845: Enable tab-completion in the interactive interpreter by default, 
thanks to a new sys.__interactivehook__.
http://hg.python.org/cpython/rev/d5ef330bac50

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2013-05-04 Thread Antoine Pitrou

Antoine Pitrou added the comment:

End-users will hopefully rejoice :)

--
resolution:  - fixed
stage: patch review - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2013-05-02 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
nosy: +serhiy.storchaka

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2013-05-01 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


Added file: http://bugs.python.org/file30098/c43e264256e4.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2013-05-01 Thread Antoine Pitrou

Antoine Pitrou added the comment:

In the spirit of pushing this forward, here is an updated patch using the 
sys.__interactivehook__ approach. I didn't add any tests since it doesn't seem 
very easy to write any.

If nobody objects, I would like to commit this soon.

--
Added file: http://bugs.python.org/file30099/defaultreadline.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2013-03-21 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' g.rod...@gmail.com:


--
nosy: +giampaolo.rodola

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2013-03-21 Thread Florent Xicluna

Changes by Florent Xicluna florent.xicl...@gmail.com:


--
nosy: +flox

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2013-03-21 Thread Tshepang Lekhonkhobe

Changes by Tshepang Lekhonkhobe tshep...@gmail.com:


--
nosy: +tshepang

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2013-03-21 Thread Tshepang Lekhonkhobe

Changes by Tshepang Lekhonkhobe tshep...@gmail.com:


--
versions: +Python 3.4 -Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2012-10-05 Thread Steven D'Aprano

Changes by Steven D'Aprano steve+pyt...@pearwood.info:


--
nosy: +stevenjd

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2011-09-13 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

FTR, I tried checking sys.ps1 instead of argv but it’s the same problem.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2011-09-08 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +ezio.melotti

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2011-09-06 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

  It's more useful to have a hook called when entering interactive mode, 
  rather than a flag
  that's set from the beginning:
 We already have such a hook: $PYTHONSTARTUP

$PYTHONSTARTUP doesn't work with -i

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2011-09-06 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

 Easily detecting interactive mode is of general interest for
 customization.
Thanks for the feedback.  We could open a feature request for that, and/or ask 
python-ideas.

 What if C also set sys.flags.interactive in python mode, or exposed
 sys.flags.implicit_interactive (but with better name)?
An attribute in the sys module sounds like a good idea.  It would not be an 
attribute of sys.flags though, as those are strictly command-line arguments.

 It's more useful to have a hook called when entering interactive mode, rather 
 than a flag
 that's set from the beginning:
We already have such a hook: $PYTHONSTARTUP

 calling e.g. sys.__interactivehook__ sounds even better.
That’s another interesting idea.

 BTW, drawback of doing any such setup in site.py: python -S would be 
 unfriendly!
People using -S don’t want the customizations done in site, so I don’t think 
there’s a problem here.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2011-09-06 Thread Cherniavsky Beni

Cherniavsky Beni b...@google.com added the comment:

On Tue, Sep 6, 2011 at 17:54, Antoine Pitrou rep...@bugs.python.org wrote:

It covers the user's desire customization very well (esp. if it worked with
-i).
sys.__interactivehook__ has the benefit of being cleanly settable from
python code.
But it might well be a YAGNI idea.

$PYTHONSTARTUP doesn't work with -i


Perhaps it should?
I can't think of a thing that makes sense in $PYTHONSTARTUP that I wouldn't
want with -i.
(and if there is one, one can add a test for sys.flags.interactive, or run
with env PYTHONSTARTUP='')

Point to watch out for: errors in $PYTHONSTARTUP.
One of the uses of python -i script.py is doing pdb.pm() on an exception
thrown by the script;
ideally a broken $PYTHONSTARTUP would not overr

customization than editing?
The fact that it'd be implemented in site.py?
Yes, obviously, if it's implemented in site.py, -S should disable it.  My
point was that it doesn't have to be implemented there.  You could drink the
cool aid instead :-)

--
Added file: http://bugs.python.org/file23108/unnamed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___div class=gmail_quoteOn Tue, Sep 6, 2011 at 17:54, Antoine Pitrou span 
dir=ltrlt;a href=mailto:rep...@bugs.python.org; 
target=_blankrep...@bugs.python.org/agt;/span wrote:brblockquote 
class=gmail_quote style=margin:0 0 0 .8ex;border-left:1px #ccc 
solid;padding-left:1ex


divbrspan style=color:rgb(34, 34, 34);font-family:arial, 
sans-serif;font-size:14pxÉric Araujo lt;a href=mailto:mer...@netwok.org; 
style=color:rgb(17, 85, 204) target=_blankmer...@netwok.org/agt; added 
the comment:br


/span
/divdivgt; gt; It#39;s more useful to have a hook called when entering 
interactive mode, rather than a flagbr
gt; gt; that#39;s set from the beginning:br
gt; We already have such a hook: $PYTHONSTARTUPbr
br/div/blockquotedivGood point!/divdivIt covers the user#39;s 
desire customization very well (esp. if it worked with 
-i)./divdivsys.__interactivehook__ has the benefit of being cleanly 
settable from python code./div

divBut it might well be a YAGNI idea./divdivbr/divblockquote 
class=gmail_quote style=margin:0 0 0 .8ex;border-left:1px #ccc 
solid;padding-left:1exdiv

/div$PYTHONSTARTUP doesn#39;t work with 
-ibr/blockquotediv /divdivPerhaps it should?/divdivI can#39;t 
think of a thing that makes sense in $PYTHONSTARTUP that I wouldn#39;t want 
with -i./divdiv(and if there is one, one can add a test 
for sys.flags.interactive, or run with env PYTHONSTARTUP=#39;#39;)/div


div /divdivPoint to watch out for: errors in 
$PYTHONSTARTUP./divdivOne of the uses of quot;python -i script.pyquot; is 
doing a href=http://pdb.pm;pdb.pm/a() on an exception thrown by the 
script;/divdiv

ideally a broken $PYTHONSTARTUP would not overr/divdivbr/divblockquote 
class=gmail_quote style=margin:0 0 0 .8ex;border-left:1px #ccc 
solid;padding-left:1exdivdivdivgt; BTW, drawback of doing any such 
setup in site.py: quot;python -Squot; would be unfriendly!People using -S 
don’t want the customizations done in site, so I don’t think there’s a 
problem here./div


divbr/div/div/div/blockquotedivpython -S doesn#39;t disable 
readline.  What makes completions more of a quot;customizationquot; than 
editing?/divdivThe fact that it#39;d be implemented in site.py?/div


divYes, obviously, if it#39;s implemented in site.py, -S should disable it. 
 My point was that it doesn#39;t have to be implemented there.  You could 
drink the cool aid instead :-)/div/div
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2011-09-06 Thread Cherniavsky Beni

Cherniavsky Beni b...@google.com added the comment:

[sorry, html mail was bad idea]

On Tue, Sep 6, 2011 at 17:54, Antoine Pitrou rep...@bugs.python.org wrote:

Éric Araujo mer...@netwok.org added the comment:
  It's more useful to have a hook called when entering interactive mode,
  rather than a flag
  that's set from the beginning:
 We already have such a hook: $PYTHONSTARTUP

Good point!
It covers the user's desire customization very well (esp. if it worked with -i).
sys.__interactivehook__ has the benefit of being cleanly settable from python 
code.
But it might well be a YAGNI idea.

 $PYTHONSTARTUP doesn't work with -i
 
Perhaps it should?
I can't think of a thing that makes sense in $PYTHONSTARTUP that I wouldn't 
want with -i.
(and if there is one, one can add a test for sys.flags.interactive, or run with 
env PYTHONSTARTUP='')
 
Point to watch out for: errors in $PYTHONSTARTUP.
One of the uses of python -i script.py is doing pdb.pm() on an exception 
thrown by the script;
ideally a broken $PYTHONSTARTUP would not overr

  BTW, drawback of doing any such setup in site.py: python -S 
  would be unfriendly!
 People using -S don’t want the customizations done in site, so I 
 don’t think there’s a problem here.

python -S doesn't disable readline.  What makes completions more of a 
customization than editing?
The fact that it'd be implemented in site.py?
Yes, obviously, if it's implemented in site.py, -S should disable it.  My point 
was that it doesn't have to be implemented there.  You could drink the cool aid 
instead :-)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2011-09-06 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


Removed file: http://bugs.python.org/file23108/unnamed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2011-09-06 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
Removed message: http://bugs.python.org/msg143617

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2011-09-06 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

 sys.__interactivehook__ has the benefit of being cleanly settable from python 
 code.
 But it might well be a YAGNI idea.
I’ll ask python-dev about that.  For the moment, I prefer the idea of a new 
sys.interactive attribute (boolean).

 $PYTHONSTARTUP doesn't work with -i
 Perhaps it should?
-i means two things: interactive and inspect.  The second meaning is used when 
you want python to execute a script or module just as usual but without exiting 
afterward, to let you inspect the state of the program.  Supporting 
PYTHONSTARTUP would change these use cases and be an unacceptable change.

 
 BTW, drawback of doing any such setup in site.py: python -S 
 would be unfriendly!
 People using -S don’t want the customizations done in site, so I 
 don’t think there’s a problem here.

 python -S doesn't disable readline.
 What makes completions more of a customization than editing?
 The fact that it'd be implemented in site.py?
If you go back to the first messages of this report, you’ll see that I wasn’t 
sure what a good location would be, and decided site because it did not look 
out of place.  There isn’t a stronger rationale than that.  One could argue 
that even now, site mixes disparate functionality: one program could wish to 
use -S to disable sys.path munging but run into bugs because the builtin exit 
is not defined anymore for example.

 Yes, obviously, if it's implemented in site.py, -S should disable it.
We agree.

 My point was that it doesn't have to be implemented there.
I really want to explore all options before renouncing to implement it in site. 
 I’d like the implementation to be maintainable and shareable with other Python 
VMs.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2011-09-05 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

We can’t just decide to enable completion by checking “'readline' in 
sys.modules” in site, because it always returns False.  site is imported in 
Python/pythonrun.c, and I guess that Modules/main.c is run afterwards.  More 
importantly, I think the import of readline in Modules/main.c is a CPython 
implementation detail, and I’d prefer to have code in site that is directly 
useful for other VMs.  (I’d go as far as proposing to remove the import 
readline from main.c, when my patch makes it obsolete.)

I re-read the docs for sys.argv and the -m switch and decided to translate to C 
checks (“command == NULL  filename == NULL  module == NULL”) to “if not 
sys.argv[0]”.  Unfortunately, sys.argv is not available when site is imported, 
so this is a dead end :(

So, I could try your _setupinteractive module idea, even though I think it’s a 
bit unclean, or drink the cool aid and set up completion in main.c.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2011-09-05 Thread Cherniavsky Beni

Cherniavsky Beni b...@google.com added the comment:

Easily detecting interactive mode is of general interest for customization.

1. What if C also set sys.flags.interactive in python mode,
   or exposed sys.flags.implicit_interactive (but with better name)?

2. It's more useful to have a hook called when entering interactive mode,
   rather than a flag that's set from the beginning:

   $ python -i -c 'import sys; print sys.flags.interactive'
   1


   For this, importing _setupinteractive is a step forward;
   calling e.g. sys.__interactivehook__ sounds even better.
   (site.py would set it by default to a function that enables
   rlcompleter, user can always override...)

BTW, drawback of doing any such setup in site.py: python -S would 
be unfriendly!

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2011-08-18 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


Removed file: http://bugs.python.org/file21399/fix-5845.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2011-08-18 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Updated patch (not using Mercurial, looks like I haven’t enough bandwidth to 
push all those changesets).

--
Added file: http://bugs.python.org/file22936/fix-5845.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2011-08-18 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Interestingly, there's already the following code in Modules/main.c:

if ((Py_InspectFlag || (command == NULL  filename == NULL  module == 
NULL)) 
isatty(fileno(stdin))) {
PyObject *v;
v = PyImport_ImportModule(readline);
if (v == NULL)
PyErr_Clear();
else
Py_DECREF(v);
}


...meaning readline already gets imported automatically when desired. And 
indeed:

$ ./python -S
Python 3.3.0a0 (default:50f1922bc1d5, Aug 18 2011, 00:09:47) 
[GCC 4.5.2] on linux2
 import sys
 sys.modules['readline']
module 'readline' from 
'/home/antoine/cpython/default/build/lib.linux-x86_64-3.3-pydebug/readline.cpython-33dm.so'


So perhaps we could simply change this code to import another, private module 
(e.g. _setupinteractive.py) which would setup readline and rlcompleter?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2011-08-18 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 Updated patch (not using Mercurial, looks like I haven’t enough
 bandwidth to push all those changesets).

I think there's a bug in the way you are detecting interactive mode:

$ ./python -c import sys; print(sys.stdin.isatty())
True

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2011-03-25 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Ned, does readline.read_init_file() with libedit?

--
versions:  -Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2011-03-25 Thread Ned Deily

Ned Deily n...@acm.org added the comment:

readline.read_init_file() does work with libedit.  The directives read have to 
be in libedit format.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2011-03-25 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
hgrepos: +9

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2011-03-25 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
keywords: +patch
Added file: http://bugs.python.org/file21397/a5bded1b8db4.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2011-03-25 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


Added file: http://bugs.python.org/file21398/c43e264256e4.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2011-03-25 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Please ignore the generated patches, left here for Martin’s benefit, and review 
the manually attached fix-5845.diff.

I have used read_init_file instead of hard-coding tab (it’s anyway the default 
for readline).

I may have repeated the same info in too much doc files, but I preferred to 
have more than one place where people could learn about the new behavior.  
Advice welcomed.

If the basic approach looks good, especially if site still feels the right 
place for this, I will add tests.

--
keywords: +needs review
stage:  - patch review
Added file: http://bugs.python.org/file21399/fix-5845.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2011-03-25 Thread Martin v . Löwis

Changes by Martin v. Löwis mar...@v.loewis.de:


Removed file: http://bugs.python.org/file21398/c43e264256e4.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2011-03-25 Thread Martin v . Löwis

Changes by Martin v. Löwis mar...@v.loewis.de:


Added file: http://bugs.python.org/file21401/c43e264256e4.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2011-03-25 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


Added file: http://bugs.python.org/file21402/d1cbf0347eb4.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2011-03-25 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


Removed file: http://bugs.python.org/file21397/a5bded1b8db4.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2011-03-25 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


Removed file: http://bugs.python.org/file21401/c43e264256e4.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2011-03-25 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


Removed file: http://bugs.python.org/file21402/d1cbf0347eb4.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2010-12-09 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

for what it is worth, I am +1 on having completion and history file work by 
default.  The sqlite3 command line does this, for example.  I think it is what 
unix user expect nowadays, and I think it is reasonable.

Looking at my home directory, it would appear that the de-facto standard 
history file name would be .python_history.  This is based on .mysql_history, 
.psql_history, and .sqlite_history, none of which I configured explicitly to 
support history saving.

--
nosy: +r.david.murray

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2010-12-09 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Okay, that’s one question answered.  Still to solve: How to bind the right key? 
(“But perhaps tab isn’t the right key to bind. I think inputrc could set it to 
something different, perhaps shell rc files too. Is there an API to get this 
setting, does readline.so already do the right thing, or does it have to be 
added?”)

--
versions: +Python 3.3 -Python 2.7, Python 3.1

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2010-12-09 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

I think TAB is the key expected by most people, so let's make it the default.
As for the location, site.py is an adequate one IMO.

--
components: +Library (Lib) -Interpreter Core
versions: +Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2010-12-09 Thread Ned Deily

Ned Deily n...@acm.org added the comment:

Keep in bind that there the Python readline module may be linked to either GNU 
readline or the BSD editline (libedit) library and they have different command 
strings.  Note the warning here:

http://docs.python.org/dev/py3k/library/readline.html

Here's a snippet of what I have today in my startup file:

import rlcompleter
if 'libedit' in readline.__doc__:
readline.parse_and_bind(bind ^I rl_complete)
else:
readline.parse_and_bind(tab: complete)

See Issue10666 for more details and some possible changes.

--
nosy: +ned.deily, ronaldoussoren

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2010-12-09 Thread Ned Deily

Ned Deily n...@acm.org added the comment:

Keep in mind that the Python readline module may be linked to either GNU 
readline or the BSD editline (libedit) library and they have different command 
strings.  Note the warning here:

http://docs.python.org/dev/py3k/library/readline.html

Here's a snippet of what I have today in my startup file:

import rlcompleter
if 'libedit' in readline.__doc__:
readline.parse_and_bind(bind ^I rl_complete)
else:
readline.parse_and_bind(tab: complete)

See Issue10666 for more details and some possible changes.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2010-12-09 Thread Ned Deily

Changes by Ned Deily n...@acm.org:


--
Removed message: http://bugs.python.org/msg123702

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2010-12-09 Thread Ned Deily

Ned Deily n...@acm.org added the comment:

Nosying Martin: any Windows installer concerns?

--
nosy: +loewis

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2010-12-09 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

There is no readline support on Windows at all, so I don't think the Windows 
installer can be affected. I'm uncertain what the proposed change to Python is 
at this point, though.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2010-06-11 Thread Alexander Belopolsky

Changes by Alexander Belopolsky belopol...@users.sourceforge.net:


--
nosy: +belopolsky

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2010-06-06 Thread lesmana

Changes by lesmana lesm...@gmx.de:


--
nosy: +lesmana

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2009-04-27 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

He, adding completion is also something I find myself adding on every
box on which I use Python...

--
nosy: +pitrou

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2009-04-26 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

What would be the right place for this to happen? I first thought of
site.py, but -S would then turn off readline support. Does it have to be
done somewhere in C land?

But perhaps tab isn’t the right key to bind. I think inputrc could set
it to something different, perhaps shell rc files too. Is there an API
to get this setting, does readline.so already do the right thing, or
does it have to be added?

Moreover, in my PYTHONSTARTUP I not only bind tab to complete, but also
set a history file. Should this be automatic too? UNIX rules would
suggest a standard ~/.pyhistory file, or we could follow newer
freedesktop.org specifications [1].

So, I don’t know the history and choices behind readline.so, but from a
user point of view, being fed up with lack of tab completion finally had
me put up a PYTHONSTARTUP file with these settings, and then some useful
functions, and so on. This lack of completion was ultimately a good
thing for me. Still, completion could be made to work out of the box,
and the man page could link to the doc explaining how to customize this
behavior.

[1] XDG Base Directory Specification:
http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html

Cheers, Merwok

--
nosy: +Merwok

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2009-04-25 Thread Cherniavsky Beni

New submission from Cherniavsky Beni c...@users.sf.net:

An interactive prompt should offer working completion out-of-the-box,
without requiring every Python user on earth to create a $PYTHONSTARTUP
with '''import readline; readline.parse_and_bind(tab: complete)'''.

Note that it should work not only when Python is run without arguments,
but also when running with the -i option.
And ideally, it should only install the completion function when
dropping to the interpreter, not from the start, so that code that runs
before dropping to the interpreter is not affected.  But this is really
not important.

Safety: if 'rlcompleter' or 'readline' are not availiable (e.g. broken
python install), the user must still get a working interpreter, just
without completion.

Portability: there won't be completion on windows (as long as pyreadline
or similar is not part of Python).  But that shouldn't delay unix support!

--
messages: 86570
nosy: cben
severity: normal
status: open
title: rlcompleter should be enabled automatically

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5845] rlcompleter should be enabled automatically

2009-04-25 Thread Cherniavsky Beni

Changes by Cherniavsky Beni c...@users.sf.net:


--
components: +Interpreter Core
type:  - feature request
versions: +Python 2.7, Python 3.1

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5845
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com