[Python-ideas] 80 character line width vs. something wider
Ben Finney
ben+python at benfinney.id.au
Thu May 21 05:45:32 CEST 2009
"Raymond Hettinger" <python at rcn.com> writes:
> FWIW, I posted two recurring examples of where it is awkward in normal
> python programming. One, raising exceptions with messages -- the
> message doesn't typically start until 30th column or so.
As was covered earlier in the thread, cases like that are why the
following style makes sense for call parameters::
def error_emitter():
raise some.name.space.LongDescriptiveError(
"Message for the error"
" which can cross multiple lines if necessary",
other, args)
> Two, in unittests using self.assertRaises(SomeException, expr), the
> expr part doesn't typically start until the 35th column or so.
class FrobnicationTest(unittest.TestCase):
def test_frobnicates_the_spangle(self):
self.assertRaises(
SomeException, expr)
So neither of these use cases is materially harmed by an 80-column
limit.
> I think the Google example is instructive. Their two space tabs are
> not a natural preference for anyone I know. Instead, it is an
> accommodation born from trying to fit nested, indented code into 80
> columns. I'm pretty much in agreement with the OP that going to 90 or
> 100 columns is a better solution.
Given the available options for making code fit nicely within 80-column
lines and 4-column indentation levels, and the benefits to be had from
doing so, I don't agree with your position.
--
\ “Never express yourself more clearly than you are able to |
`\ think.” —Niels Bohr |
_o__) |
Ben Finney
More information about the Python-ideas
mailing list