[issue18472] Update PEP 8 to encourage modern conventions

Ezio Melotti report at bugs.python.org
Mon Aug 5 17:18:33 CEST 2013


Ezio Melotti added the comment:

I'm a bit late but I still have a few comments:

+  The paren-using form also means that when the exception arguments are
+  long or include string formatting, you don't need to use line
+  continuation characters thanks to the containing parentheses.

This paragraph doesn't add much and could be removed IMHO.


+- When binding caught exceptions to a name, prefer the explicit name
+  binding syntax added in Python 2.6::
+
+      try:
+          process_data()
+      except Exception as exc:
+          raise DataProcessingFailedError(str(exc))

It took me a bit to realize that this is talking about "as".  I think it would be better to be more explicit, and simplify the example a bit so that it's not as distracting.


+  Note that in Python 3, ``unicode`` and ``basestring`` no longer exist
+  (there is only ``str``) and a bytes object is no longer a kind of
+  string (it is a sequence of integers instead)

Is there any specific reason to use "sequence of integers" instead of "sequence of bytes"?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18472>
_______________________________________


More information about the Python-bugs-list mailing list