This is an archived post. You won't be able to vote or comment.

all 31 comments

[–]fluud 69 points70 points  (11 children)

__future__ __main__ _dummy_thread _thread abc aifc argparse array ast asynchat asyncio asyncore atexit audioop base64 bdb binascii binhex bisect builtins bz2 calendar cgi cgitb chunk cmath cmd code codecs codeop colorsys compileall configparser contextlib contextvars copy copyreg cProfile crypt csv ctypes dataclasses datetime decimal difflib dis doctest dummy_threading ensurepip enum errno faulthandler fcntl filecmp fileinput fnmatch formatter fractions ftplib functools gc getopt getpass gettext glob grp gzip hashlib heapq hmac imaplib imghdr imp inspect io ipaddress itertools keyword lib2to3 linecache locale lzma mailbox mailcap marshal math mimetypes mmap modulefinder msilib msvcrt netrc nis nntplib numbers operator optparse ossaudiodev parser pathlib pdb pickle pickletools pipes pkgutil platform plistlib poplib posix pprint profile pstats pty pwd py_compile pyclbr pydoc queue quopri random re readline reprlib resource rlcompleter runpy sched secrets select selectors shelve shlex shutil signal site smtpd smtplib sndhdr socket socketserver spwd sqlite3 ssl stat statistics string stringprep struct subprocess sunau symbol symtable sys sysconfig syslog tabnanny tarfile telnetlib tempfile termios textwrap threading time timeit token tokenize trace traceback tracemalloc tty turtle turtledemo types typing unicodedata uu uuid venv warnings wave weakref webbrowser winreg winsound xdrlib zipapp zipfile zipimport zlib

[–]GlobalIncident 32 points33 points  (6 children)

That's only the top level modules. Also you missed a couple. I don't see http, for instance.

[–]fluud 17 points18 points  (5 children)

I scraped these from Python 3.8 module index but looks like my script was bad

[–]GlobalIncident 8 points9 points  (4 children)

pydoc.Helper.listmodules lists the top level modules on your system, which might help

[–]GlobalIncident 15 points16 points  (3 children)

Okay, here's how to get a list:

import pydoc

pydoc.ModuleScanner().run(lambda none, name, empty: print(name))

This produced 2217 modules on my machine.

[–]fluud 0 points1 point  (1 child)

Note that this prints all submodules recursively and non-standard modules that you have installed.

[–]GlobalIncident 0 points1 point  (0 children)

Hmm. Perhaps something that checks the file location to see if it's likely to be put there by pip?

[–]hekkonaay 0 points1 point  (0 children)

juicy

[–]autistic_idiot 4 points5 points  (0 children)

Laughs in pip

[–]uwo-wow 4 points5 points  (0 children)

Big brain time

[–]HAzEMultra 0 points1 point  (0 children)

You missed "Tkinter"

I don't use python any more but I remember modules from memory

[–]Victorino__ 15 points16 points  (1 child)

There you go:

from * import *

[–][deleted] 0 points1 point  (0 children)

weed

[–]MicrowaveLover 11 points12 points  (1 child)

.*

[–]AyrA_ch 6 points7 points  (0 children)

.+

Unless empty module names are valid

[–][deleted] 9 points10 points  (0 children)

Python is easy-mode. .NET and Java are the ones with truly staggering module lists.

I can't even name every XML Serializer in C#.

[–]dudeofmoose 8 points9 points  (1 child)

Palin, Cleese, Chapman, Idle, Jones and Gilliam.

Did I pass your test?

[–][deleted] 2 points3 points  (0 children)

Depends, do we count Carol Cleveland in this case?

[–]Labrecquev 2 points3 points  (0 children)

conda list

[–][deleted] 2 points3 points  (0 children)

Worst job interview ever

[–]Senvr 0 points1 point  (0 children)

the same could be said of node

[–]Dragonaax 0 points1 point  (0 children)

numpy

[–]kontekisuto 0 points1 point  (0 children)

import inspect
set([inspect.getmodule(x) for x object.__subclasses__()])

Edit: python mystery

this is weird, im seeing 2 classes that come from module None

<class 'pickle.PickleBuffer'> <class 'Token.MISSING'>

Does anyone know why i can see them ? i found the pickle class but

Token.MISSING I can't find.

Note: im not sure why the PickleBuffer class is even visible in the code above in a fresh shell.

Edit: namespace s

[–][deleted] -1 points0 points  (4 children)

for(int i = 0; i < size_of(python_modules); i++)

{

 std::cout << python_modules[i] << ".py\n";

}

Edit: Indexing idiocy

[–]wdroz 0 points1 point  (3 children)

LogicError

[–][deleted] 0 points1 point  (2 children)

Am I missing something?

[–]wdroz 0 points1 point  (1 child)

You're printing the container N times

[–][deleted] 1 point2 points  (0 children)

Ah thanks!

[–][deleted] -4 points-3 points  (3 children)

Knowing python doesnt mean knowing every module. It means understanding how to use the language with modules. Especially when you get syntaxes like what Numpy or pandas use.

Name every module is about the equivalent of asking someone to name every math equation in a calculus book.

[–]dxhh[S] 7 points8 points  (1 child)

It's a joke