Repetitive paths seem un-Pythonic


Flat is better than nested. - PEP 20 - Zen of Python

Repetitive paths are confusing for both your tools and your developers. - Ken Reitz

what is a repetitive path?

First, what is a repetitive path?

Let me show you.

Go to Flask's Github repo.

# root dir: Flask
├── docs
├── flask # here, too!
├── tests

Repeating 'flask' = repetitive path

repeat offenders

Same thing in mypy:

# root dir: mypy
├── docs
├── misc
├── mypy # we get it!

Celery does it, and so does httpie, and the project initializers for Django and Scrapy do it, too.

There are some variations on the theme, too. pip does this:

# root dir: pip
├── docs
├── src
│   └── pip # somehow better and worse simultaneously
├── tests

sqlalchemy does this:

# root dir: sqlalchemy
├── doc
├── lib
│   └── sqlalchemy # fine, whatever
├── test

signs of hope

There are exceptions. pytest and Pillow both put their source code in, well, src.

Make sense, yes?

Pythonistas, help me understand

Strangest of all:

# root dir: requests
├── docs
├── requests # up is down, left is right
├── tests

I want to ask Python people about this.

I'd ask StackOverflow but the mob would sweep me away in a wave of downvotes. Maybe IRC...