On 8/3/19 4:15 AM, Steven D'Aprano wrote:
On Fri, Aug 02, 2019 at 02:16:52PM -0400, Dan Sommers wrote:
I agree, but that's assuming that you "know" what's there and just have
to be reminded. IMO, it helps less with discovering new functions, and
even less than that when it comes to discovering "new" python modules.
Pressing tab twice after the word import:
py> import
Display all 492 possibilities? (y or n)
CDROM change_type_example locale site
CFRAC chardet logcheck1 smtpd
DLFCN chunk logcheck2 smtplib
[... additional lines trimmed for brevity ...]
I had completely forgotten I installed chardet!
I think you're making my point. :-)
Yes, in your Python REPL, you can get a list of all 492
importable modules. (Mine doesn't do that; neither does
ChrisA's.)
I can probably guess what some of those modules do, like
locale. If I don't know what SMTP is, then I still don't
know which one of those modules to use to send email.
I was going to say how much better the online docs at
docs.python.org/3/library were, but that didn't work out,
either. On that page, the only appearance of the word email
is the email module, which then refers to the smptlib
module.
OTOH, searching the internet for python send email turns up
StackOverflow and everyone's and their brother's blogs and
tutorials for sending email with Python. And *now* I've
discovered the smptlib module. But I still don't really
know how to use it.
Once I know what SMTP is, and what the smtplib module does,
and I've used it a couple of times, then seeing the list of
names inside the module might remind me how to use it.
So maybe SMTP is an extreme case. I'm sure there are others.
How does TAB completion help me to discover hashlib, if all I
know is that I want the SHA-3 of some file?
Again, I'm not disputing the usefulness of TAB completion;
my point is that it's a sub-optimal tool for discoverability.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/python-ideas@python.org/message/EVV4YRQD3GFIDQVNTPEG3SXEYMJ57A2M/
Code of Conduct: http://python.org/psf/codeofconduct/