Storing a big amount of path names

Ben Finney ben+python at
Thu Feb 11 19:44:17 EST 2016

Paulo da Silva <p_s_d_a_s_i_l_v_a_ns at> writes:

> What is the best (shortest memory usage) way to store lots of
> pathnames in memory

I challenge the premise. Why is “shortest memory usage” your criterion
for “best”, here?

How have you determined that factors like “easily understandable when
reading”, or “using standard Python idioms”, are less important?

As for “lots of pathnames”, how many are you expecting? Python's
built-in container types are highly optimised for quite large amounts of

Have you measured an implementation with normal built-in container types
with your expected quantity of items, and confirmed that the performance
is unacceptable?

> Thanks for any suggestion.

I would suggest that the assumption you have too much data for Python's
built-in container types, is an assumption that should be rigorously
tested because it is likely not true.

 \      “We suffer primarily not from our vices or our weaknesses, but |
  `\    from our illusions.” —Daniel J. Boorstin, historian, 1914–2004 |
_o__)                                                                  |
Ben Finney

More information about the Python-list mailing list