[Python-Dev] PEP 463: Exception-catching expressions

Chris Angelico rosuav at gmail.com
Fri Feb 21 16:41:21 CET 2014


On Sat, Feb 22, 2014 at 1:22 AM, Rob Cliffe <rob.cliffe at btinternet.com> wrote:
> Small point: in one of your examples you give a plug for the PEP "note the
> DRY improvement".
> I would suggest that similarly
>     perhaps in your Lib/tarfile.py:2198 example you point out the increase
> in readability due to the 2 lines lining up
>     in your Lib/ipaddress.py:343 example you point out that the new form is
> probably an improvement (i.e. probably closer to the author's intention) as
> it will NOT catch an AttributeError evaluating "ips.append" (this would
> matter e.g. if "append" were mis-spelt).  YOU are clearly aware of this but
> it would often escape the casual reader.

Sure. Added a paragraph down the bottom of the section explaining the
benefit of the narrowed scope.

ChrisA


More information about the Python-Dev mailing list