shal we redefine "module" and "package"?

Folks: Here's an experiment you can perform. Round up a Python programmer and ask him the following three questions: Q1. You type "import foo" and it works. What kind of thing is foo? Q2. You go to the Python package index and download something named "bar-1.0.0.tar.gz". What kind of thing is bar? Q3. What is a "distribution"? I'm willing to bet that you will get the following answers: A1. foo is a module. A2. bar is a package. A3. A distribution is a version of Linux that comes with a lot of Free Software. Unfortunately these answers aren't quite right. A "package" is actually a directory containing an __init__.py file, and a distribution is actually what you think of when you say "package" -- a reusable package of Python code that you can, for example, get from the Python package index. Educational efforts such as the Python tutorial and the distutils docs have not succeeded in training Python programmers to understand the terminology for these things as used by the Python implementors, so perhaps instead the implementors should start using the terminology understood by the programmers: 1. A "module" shall henceforth be the name for either a foo.py file (a single-file module), or a directory with an __init__.py in it (a directory module). 2. A "package" shall henceforth be the name of the thing that is currently called a "distribution". Regards, Zooko who doesn't mind stirring up trouble on occasion...

zooko wrote:
Folks:
Here's an experiment you can perform. Round up a Python programmer and ask him the following three questions:
Q1. You type "import foo" and it works. What kind of thing is foo?
foo is a package or a module. Not enough information is provide here to say which.
Q2. You go to the Python package index and download something named "bar-1.0.0.tar.gz". What kind of thing is bar?
bar is a package, a module, or a collection of a number of these things. Again, not enough information is provided in the question to say which is actually the case. Cheers, Nick. P.S. People, including programmers, are often sloppy with terminology. This is not a new problem. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia --------------------------------------------------------------- http://www.boredomandlaziness.org

Nick Coghlan wrote:
zooko wrote:
Q1. You type "import foo" and it works. What kind of thing is foo?
foo is a package or a module. Not enough information is provide here to say which.
Actually, it could be anything! But it's *probably* a module (or package, but a package is also a module, if we're being fussy about terminology). -- Greg

zooko <zooko@zooko.com> writes:
I'm willing to bet that you will get the following answers:
A1. foo [from 'import foo'] is a module.
A2. bar [of 'bar-1.2.3.tar.gz'] is a package.
A3. A distribution is a version of Linux that comes with a lot of Free Software.
Unfortunately these answers aren't quite right.
More accurately, they're right in the context from which the speaker learned them.
A "package" is actually a directory containing an __init__.py file, and a distribution is actually what you think of when you say "package" -- a reusable package of Python code that you can, for example, get from the Python package index.
Only within Python's terminology. This, of course, conflicts with the meanings that adhere to those words just about everywhere else on the user's operating system.
Educational efforts such as the Python tutorial and the distutils docs have not succeeded in training Python programmers to understand the terminology for these things as used by the Python implementors,
More accurately, the meanings you list in the hypothetical responses above are entrenched and more useful for general use.
so perhaps instead the implementors should start using the terminology understood by the programmers:
In principle this would be good. However:
1. A "module" shall henceforth be the name for either a foo.py file (a single-file module), or a directory with an __init__.py in it (a directory module).
How then to distinguish between these? They're clearly separate concepts, and I think they need distinct terms.
2. A "package" shall henceforth be the name of the thing that is currently [in Python terminology] called a "distribution".
That one would be good. You then have the converse problem of changing the use of terminology that is currently entrenched in existing Python documentation and minds :-) -- \ "Always code as if the guy who ends up maintaining your code | `\ will be a violent psychopath who knows where you live." —John | _o__) F. Woods | Ben Finney
participants (4)
-
Ben Finney
-
Greg Ewing
-
Nick Coghlan
-
zooko