Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Improvement to python module list generation used for command completion
- X-seq: zsh-workers 35911
- From: Antony Lee <antony.lee@xxxxxxxxxxxx>
- To: "Jun T." <takimoto-j@xxxxxxxxxxxxxxxxx>
- Subject: Re: Improvement to python module list generation used for command completion
- Date: Sat, 25 Jul 2015 14:33:46 -0700
- Cc: zsh-workers@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=oyd4wcoce6mdfSId8TNOSnowSa4cRcIQmNeJ8D8RCjA=; b=DsbUIB+YN2J1cNZpQIAR7iVzWjp6kcSBWaRY3u/SzNIP3fIJJML6NKr3BzAr+pJ4bB +CifN0TdmXUo+H44m8ErkY04AfMdh2fZ7UemFGwfXXo8BQgQcresq9BYLSvzprQ5E+AA q52GqIkYTZoIGZwy6g2wd5zLrAOHIZ0EkbS4mspXtHcwvgNK0visSIXdDY/G7pmceRP3 hkMcs6Or29gTgV1zeCOdnRna/TNsFoqlgMr0v0uPV2Tikz8toPvCtmimmz3jzw+68nF2 9w+THNk/tZlLLWPC8MTl6c+GTLSVBEEW024koB4WIokMAMFPHfS4jzJ3fdpO0CriOI4W JBag==
- In-reply-to: <F7383D07-4E00-4FC2-8C0B-0A7A728D12D5@kba.biglobe.ne.jp>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CAGRr6BETX9g1RbBm9Ud0hgHp0C90gHsmW5CL+A0NDx2e_rmL4g@mail.gmail.com> <F7383D07-4E00-4FC2-8C0B-0A7A728D12D5@kba.biglobe.ne.jp>
- Sender: anntzer.lee@xxxxxxxxx
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@xxxxxxxxxxxxxxxxx>:
>
> 2015/07/25 12:37, Antony Lee <antony.lee@xxxxxxxxxxxx> 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)'.
>
Messages sorted by:
Reverse Date,
Date,
Thread,
Author