python 2.7.12 on Linux behaving differently than on Windows

eryk sun eryksun at gmail.com
Tue Dec 6 08:08:31 EST 2016


On Tue, Dec 6, 2016 at 12:26 PM, Chris Angelico <rosuav at gmail.com> wrote:
> On Tue, Dec 6, 2016 at 10:56 PM, BartC <bc at freeuk.com> wrote:
>> In that directory (which was on Windows but accessible via a virtual Linux),
>> typing any Linux command followed by * would have required all 3.4 million
>> directory entries to be accessed in order to build a 3.4 million-element
>> argv list. I've no idea how long that would have taken.
>
> I just asked Python to build me a 4-million-element list, and it took
> no visible time - a small fraction of a second. Don't be afraid of
> large argument lists. We're not writing 8088 Assembly Language
> programs in 64KB of working memory here.

The problem isn't building an arbitrary list with millions of
elements. The problem is the time it would take to read millions of
filenames from a directory. It depends on the performance of the disk
and filesystem. Be careful with globbing. Think about the consequences
before running a command, especially if you're in the habit of
creating directories with hundreds of thousands, or millions, of
files. It's not a problem that I've ever had to deal with.



More information about the Python-list mailing list