[Python-ideas] from __pip__ import

Steven D'Aprano steve at pearwood.info
Mon Sep 19 20:42:18 EDT 2016


On Tue, Sep 20, 2016 at 09:34:12AM +1000, Chris Angelico wrote:

> It's more than that, though. When a student is given an assignment,
> it's usually to help said student to learn to *write code*, not to
> learn how to walk into the plumbing store of PyPI and look for
> something that approximates to the job being done.

That might be sufficient for theoretical computer science courses, but 
it is *far* from sufficient for learning to be a professional 
programmer. I think that programmer education lets students down hugely. 
Knowing how to "walk into the plumbing store" to get a standard plumbing 
fixture is a skill programmers desperately need.

(We also need better standard plumbing fixtures, but that's another 
story.)

Failure to teach appropriate use of external dependencies, including 
when to use them and when not to, is part of the reason so many 
programmers suffer under Not Invented Here syndrome. It is not always 
appropriate to use PyPI, but being able to use it is an essential skill 
for programmers.

To be a professional programmer, you need more skills than just writing 
code. You need to be able to estimate costs, write and use tests, write 
documentation, etc, and most relevant to this discussion, manage 
dependencies.

Notice I didn't say "install dependencies". There is more to dependency 
management than just automatically installing any failed import.




> Maybe it's
> different at university, but with my students, it's always been "no
> external libraries" (and in some cases, a common-sense avoidance of
> obvious solutions from the standard library - if you teach someone how
> to implement a sort and the response is simply "lst.sort()", it's not
> exactly implementing anything).

This is off-topic, but unless you are specifically doing an algorithms 
course, why would you bother teaching anyone to implement a sort? Do you 
teach them to implement their own float multiplication as well?


> So the use-case for this isn't nearly
> as big as it might be. By the time you get to writing large
> applications (again, taking it from my students' work: a Flask-based
> web app), it's not illogical to have a requirements.txt and standard
> pip incantations.

Indeed.


-- 
Steve


More information about the Python-ideas mailing list