Re: Getting a list of all modules

2014-08-03 Thread Mark Lawrence
On 01/08/2014 16:41, Steven D'Aprano wrote: On Fri, 01 Aug 2014 14:39:09 +0100, Robert Kern wrote: Take a look at what has already been implemented in IPython: https://github.com/ipython/ipython/blob/master/IPython/core/ completerlib.py#L208 Awesome! Thank you! Is

Re: Bug with help (was Re: Getting a list of all modules)

2014-08-02 Thread Heinz Schmitz
Akira Li wrote: Look at how `help('modules')` is implemented. Though it crashes on my system. Have you reported this at bugs.python.org or is there already an issue for the problem that you see? It is this issue for python2.7: https://bugs.launchpad.net/ubuntu/+source/python2.7/+bug/896836

Re: Bug with help (was Re: Getting a list of all modules)

2014-08-02 Thread Robert Kern
On 2014-08-02 09:33, Heinz Schmitz wrote: Akira Li wrote: Look at how `help('modules')` is implemented. Though it crashes on my system. Have you reported this at bugs.python.org or is there already an issue for the problem that you see? It is this issue for python2.7:

Re: Bug with help (was Re: Getting a list of all modules)

2014-08-02 Thread Terry Reedy
On 8/2/2014 8:13 AM, Robert Kern wrote: On 2014-08-02 09:33, Heinz Schmitz wrote: Akira Li wrote: Look at how `help('modules')` is implemented. Though it crashes on my system. Have you reported this at bugs.python.org or is there already an issue for the problem that you see? It is this

Re: Getting a list of all modules

2014-08-02 Thread jonnicoll11
On Friday, 1 August 2014 16:41:41 UTC+1, Steven D'Aprano wrote: On Fri, 01 Aug 2014 14:39:09 +0100, Robert Kern wrote: Take a look at what has already been implemented in IPython: https://github.com/ipython/ipython/blob/master/IPython/core/ completerlib.py#L208

Re: Getting a list of all modules

2014-08-02 Thread Mark Lawrence
On 02/08/2014 22:13, jonnicol...@googlemail.com wrote: On Friday, 1 August 2014 16:41:41 UTC+1, Steven D'Aprano wrote: On Fri, 01 Aug 2014 14:39:09 +0100, Robert Kern wrote: Take a look at what has already been implemented in IPython:

Re: Getting a list of all modules

2014-08-01 Thread Robert Kern
On 2014-07-31 11:41, Steven D'Aprano wrote: On Wed, 30 Jul 2014 21:22:18 +0800, Leo Jay wrote: On Wed, Jul 30, 2014 at 3:43 PM, Steven D'Aprano st...@pearwood.info wrote: I'm looking for a programmatic way to get a list of all Python modules and packages. Not just those already imported, but

Re: Getting a list of all modules

2014-08-01 Thread Steven D'Aprano
On Fri, 01 Aug 2014 14:39:09 +0100, Robert Kern wrote: Take a look at what has already been implemented in IPython: https://github.com/ipython/ipython/blob/master/IPython/core/ completerlib.py#L208 Awesome! Thank you! -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: Bug with help (was Re: Getting a list of all modules)

2014-08-01 Thread Akira Li
Mark Lawrence breamore...@yahoo.co.uk writes: On 31/07/2014 19:55, Akira Li wrote: Steven D'Aprano st...@pearwood.info writes: I'm looking for a programmatic way to get a list of all Python modules and packages. Not just those already imported, but all those which *could* be imported. ...

Re: Getting a list of all modules

2014-07-31 Thread Steven D'Aprano
On Wed, 30 Jul 2014 21:22:18 +0800, Leo Jay wrote: On Wed, Jul 30, 2014 at 3:43 PM, Steven D'Aprano st...@pearwood.info wrote: I'm looking for a programmatic way to get a list of all Python modules and packages. Not just those already imported, but all those which *could* be imported. If

Re: Getting a list of all modules

2014-07-31 Thread Roy Smith
In article 53da1d5a$0$29974$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: I'm working on tab completion for module names. I have some alpha-quality code working, so if I hit TAB after typing import ma I get this: py import ma macpath

Re: Getting a list of all modules

2014-07-31 Thread Chris Angelico
On Thu, Jul 31, 2014 at 9:55 PM, Roy Smith r...@panix.com wrote: In article 53da1d5a$0$29974$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: I'm working on tab completion for module names. I have some alpha-quality code working, so if I hit TAB

Re: Getting a list of all modules

2014-07-31 Thread Akira Li
Steven D'Aprano st...@pearwood.info writes: I'm looking for a programmatic way to get a list of all Python modules and packages. Not just those already imported, but all those which *could* be imported. ... Is this problem already solved? Can anyone make any suggestions? Look at how

Bug with help (was Re: Getting a list of all modules)

2014-07-31 Thread Mark Lawrence
On 31/07/2014 19:55, Akira Li wrote: Steven D'Aprano st...@pearwood.info writes: I'm looking for a programmatic way to get a list of all Python modules and packages. Not just those already imported, but all those which *could* be imported. ... Is this problem already solved? Can anyone make

Re: Getting a list of all modules

2014-07-31 Thread Terry Reedy
On 7/31/2014 6:41 AM, Steven D'Aprano wrote: I'm working on tab completion for module names. I have some alpha-quality code working, so if I hit TAB after typing import ma I get this: py import ma macpath macurl2path mailbox mailcap mangle markupbase math This is an

Re: Bug with help (was Re: Getting a list of all modules)

2014-07-31 Thread Terry Reedy
On 7/31/2014 3:19 PM, Mark Lawrence wrote: On 31/07/2014 19:55, Akira Li wrote: Steven D'Aprano st...@pearwood.info writes: I'm looking for a programmatic way to get a list of all Python modules and packages. Not just those already imported, but all those which *could* be imported. ... Is

Getting a list of all modules

2014-07-30 Thread Steven D'Aprano
I'm looking for a programmatic way to get a list of all Python modules and packages. Not just those already imported, but all those which *could* be imported. I have a quick-and-dirty function which half does the job: def get_modules(): extensions = ('.py', '.pyc', '.pyo', '.so', '.dll')

Re: Getting a list of all modules

2014-07-30 Thread Chris Angelico
On Wed, Jul 30, 2014 at 5:43 PM, Steven D'Aprano st...@pearwood.info wrote: Is this problem already solved? Can anyone make any suggestions? I don't know of an actual solution, but I know where I'd look for one, and that's importlib. If nothing else, you can use

Re: Getting a list of all modules

2014-07-30 Thread Peter Otten
Steven D'Aprano wrote: I'm looking for a programmatic way to get a list of all Python modules and packages. Not just those already imported, but all those which *could* be imported. I have a quick-and-dirty function which half does the job: def get_modules(): extensions = ('.py',

Re: Getting a list of all modules

2014-07-30 Thread Robert Kern
On 2014-07-30 09:46, Peter Otten wrote: Steven D'Aprano wrote: I'm looking for a programmatic way to get a list of all Python modules and packages. Not just those already imported, but all those which *could* be imported. I have a quick-and-dirty function which half does the job: def

Re: Getting a list of all modules

2014-07-30 Thread Leo Jay
On Wed, Jul 30, 2014 at 3:43 PM, Steven D'Aprano st...@pearwood.info wrote: I'm looking for a programmatic way to get a list of all Python modules and packages. Not just those already imported, but all those which *could* be imported. If you don't actually import it, how can you know it could

Re: Getting a list of all modules

2014-07-30 Thread Chris Angelico
On Wed, Jul 30, 2014 at 11:22 PM, Leo Jay python.leo...@gmail.com wrote: On Wed, Jul 30, 2014 at 3:43 PM, Steven D'Aprano st...@pearwood.info wrote: I'm looking for a programmatic way to get a list of all Python modules and packages. Not just those already imported, but all those which *could*

Re: Getting a list of all modules

2014-07-30 Thread Ian Kelly
On Jul 30, 2014 4:37 AM, Robert Kern robert.k...@gmail.com wrote: On 2014-07-30 09:46, Peter Otten wrote: Steven D'Aprano wrote: I'm looking for a programmatic way to get a list of all Python modules and packages. Not just those already imported, but all those which *could* be imported.

Re: Getting a list of all modules

2014-07-30 Thread Skip Montanaro
On Wed, Jul 30, 2014 at 2:43 AM, Steven D'Aprano st...@pearwood.info wrote: I'm looking for a programmatic way to get a list of all Python modules and packages. Not just those already imported, but all those which *could* be imported. I wrote a modified dir(), which I inject into builtins in