New PEP: Quality Guidelines For Standard Modules

Courageous jkraska1 at
Mon Jul 2 18:37:44 CEST 2001

>Let us say that you are iterating over the lines in the main loop of a 
>filter, and then, depending on the line read, have to iterate over several 
>other files. The global state prevents you from using the same instance of 
>the fileinput module.

This is inarguably and obviously bad design. The author's choice of
an implicit singleton in this case was a great error and lacked even
small amounts of foresight. The error here, however, was not the global
variable. It was the implicit global singleton attached to contextually-
dependent state.

There are many situations in which global state is appropriately stored
at the module level. sys.__stderr__ for example.

I'm not sure how to improve the language of what it is that you are asking
for, however. How about: "please don't expect the standard library committee
to accept shitty code into the standard library." :-)


More information about the Python-list mailing list