[Python-Dev] Re: PEP-317

Guido van Rossum guido@python.org
Wed, 11 Jun 2003 13:15:49 -0400


[Alex]
> An official recommendation (either way!) in the style guide would
> help -- particularly if the standard library was eventually edited to
> follow it.  What's the added value of having, as e.g. is now the case 
> in urllib.py, different statements within the same module such as:
> 
> raise IOError(e.errno, e.strerror, e.filename)
> 
> and then a few lines later:
> 
> raise IOError, ('local file error', 'not on local host')
> 
> ...?  Seems a gratuitous (even though "pretty mild") 'suckage', as
> you put it.  What's the objection to Pronouncing on one preferred
> style and putting it in the style guide?

The inconsistency you note in urllib.py is already frowned upon by the
general style guideline "consistency with immediately surrounding code
is valued more than consistency with the style guide".

A pronouncement, no matter how mild, would mean that the other style
is "wrong", and this would then cause a flurry of noise checkins of
people trying to "fix" the "wrong" code, probably introducing some
bugs in the hurry, if our experience with past flurries of style
consistency checkins is any measure.

I really don't think that

  raise IOError("message")

should always be favored over

  raise IOError, "message"

I find the latter a tad prettier (less punctuation!) even though the
former is preferred when the message is too long to comfortably fit on
a line.

--Guido van Rossum (home page: http://www.python.org/~guido/)