[Python-ideas] making a module callable

Georg Brandl g.brandl at gmx.net
Tue Nov 19 23:07:14 CET 2013


Am 19.11.2013 22:39, schrieb Haoyi Li:
>> there are some modules who just have one single main use (pprint) and could
> profit from that.
> 
> A milion times this!
> 
> pprint.pprint()
> time.time()
> random.random()
> copy.copy()
> md5.md5()
> timeit.timeit()
> glob.glob()
> cStringIO.cStringIO()
> StringIO.StringIO()

No, sorry.  Modules should be nothing more than modules: collections of APIs,
not APIs themselves.

If you want to write copy(), use import-from.

Georg



More information about the Python-ideas mailing list