3

Some libraries in Python are organized as a hierarchy of submodules. What are the pros and cons of such an design from the of view of the user of the library?

For instance:

from scipy.sparse.csgraph import dijkstra

versus:

from scipy.csgraph import dijkstra

or even an entirely flat design:

from scipy import dijkstra

Note:

  1. This question is specifically about Python, because idiomatic Python makes other tradeoffs than say idiomatic Java.
  2. I am talking about the user interface, not how you should structure your code as a library designer.
4

1 に答える 1