[Python-ideas] os.listdir default to '.'

Benjamin Peterson benjamin at python.org
Thu Jan 12 16:56:07 CET 2012


Michael Foord <fuzzyman at ...> writes:

> 
> 
> Hello all,I frequently use Python from the interactive interpreter as a shell.
It is a frequent, but mild, irritant that I have to type os.listdir('.') instead
of just os.listdir().How about making '.' a default argument for os.listdir ?All
the best,Michael-- 

$ ./python 
Python 3.3.0a0 (default:2db3ca05fbb7+, Jan 11 2012, 20:46:04) 
[GCC 4.5.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.listdir()
['autom4te.cache', 'pybuilddir.txt', 'PC', 'Tools', 'pyconfig.h', 'python',
'.hgtags', 'Makefile.pre.in', 'install-sh', 'configure.in', '.hg',
'python-gdb.py', 'README', 'Parser', 'setup.py', 'config.log', 'Makefile',
'Doc', 'Lib', 'Objects', 'build', 'LICENSE', 'pyconfig.h.in', 'Python',
'Makefile.pre', '.hgeol', 'Include', 'libpython3.3m.a', '.hgignore',
'.bzrignore', 'PCbuild', 'Modules', 'config.status', 'Misc', 'configure',
'.gitignore', 'Grammar', 'Mac']








More information about the Python-ideas mailing list