From: Antony Lee <antony.lee@berkeley.edu>
To: "Jun T." <takimoto-j@kba.biglobe.ne.jp>
Cc: zsh-workers@zsh.org
Subject: Re: Improvement to python module list generation used for command completion
Date: Sat, 25 Jul 2015 14:33:46 -0700 [thread overview]
Message-ID: <CAGRr6BGA+-UHXugybL5DvEmYHb+Zd_KYnhgQfoy1zaE+U-cvMQ@mail.gmail.com> (raw)
In-Reply-To: <F7383D07-4E00-4FC2-8C0B-0A7A728D12D5@kba.biglobe.ne.jp>
[-- Attachment #1: Type: text/plain, Size: 881 bytes --]
Actually on Python2 "(name)" is not interpreted as a single element tuple
but as a parenthesized string, which is the same as the string itself, so
it works the same.
Antony
2015-07-25 11:18 GMT-07:00 Jun T. <takimoto-j@kba.biglobe.ne.jp>:
>
> 2015/07/25 12:37, Antony Lee <antony.lee@berkeley.edu> wrote:
> > so replacing
> >
> > local script='import sys, pydoc
> > def f(p,m,d):
> > if m.find(".") < 0: sys.stdout.write(m+"\n")
> > pydoc.ModuleScanner().run(f)'
> >
> > by
> >
> > local script='import pkgutil
> > for importer, name, ispkg in pkgutil.iter_modules(): print(name)'
> >
> > in _python_modules yields a big improvement in speed.
>
> Thanks. It is indeed *much* faster.
>
> Do you think using 'print(name)' is sufficiently portable?
> It seems it works with Python 2.x, because it is interpreted
> as a print statement with a single-element tuple '(name)'.
>
next prev parent reply other threads:[~2015-07-25 21:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-25 3:37 Antony Lee
2015-07-25 18:18 ` Jun T.
2015-07-25 21:33 ` Antony Lee [this message]
2015-07-26 1:03 ` Jun T.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAGRr6BGA+-UHXugybL5DvEmYHb+Zd_KYnhgQfoy1zaE+U-cvMQ@mail.gmail.com \
--to=antony.lee@berkeley.edu \
--cc=takimoto-j@kba.biglobe.ne.jp \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).