What's in a name?

submited by
Style Pass
2024-07-06 12:30:03

Naming is important (as well as hard). Good names are good. Bad names are… bad. And we name a lot of things. In Python (a name) code is bundled and uploaded as a package (another name), usually to the Python Package Index (PyPI, a third name). Inside of these packages is code. Most commonly, Python code (but they truly can contain anything (like whole books). The only relationship between the package name and the module name(s) is the same as the relationship between a cat’s name and its demeanor. Usually “fluffy” is a fluffy cat, but it’s a convention. “Cupcake” could be the name of a very very naughty kitten.

You install requests and import requests. You install typing-extensions and import typing_extensions. You install python-dateutil you import dateutil (I guess it isn’t python_dateutil because that would imply you could import go_dateutil and that’s a can of worms the author(s) didn’t want to open). But, again, this is merely a convention.

So let’s say you wanted to map module names to package names? How well would you be doing so only via conventions? How unique are modules? What are the conventions, and who isn’t following them?

Leave a Comment