[Python-Dev] Real-world use of Counter

Nick Coghlan ncoghlan at gmail.com
Thu Nov 6 10:10:35 CET 2014


On 6 Nov 2014 06:53, "Alexander Belopolsky" <alexander.belopolsky at gmail.com>
wrote:
>
>
> On Wed, Nov 5, 2014 at 2:47 PM, R. David Murray <rdmurray at bitdance.com>
wrote:
>>
>> As I said on the issue, there is no reason I can see to add extra code
>> just to turn an AttributeError into a TypeError.  The AttributeError
>> works just fine in letting you know your input type didn't work.
>
>
> +1
>
> Unlike ValueError or LookupError, TypeError and AttributeError indicate a
logical problem with the code rather than an issue with the user input.
>From the programmer perspective, any code that catches and mutates
exceptions is a nuisance.

Right. Especially in a ducktyping context, AttributeError and TypeError are
often functionally equivalent - it usually isn't worthwhile adding code
specifically to turn one into the other.

The case that doesn't throw an exception at all seems a little strange, but
I haven't looked into the details.

Regards,
Nick.

>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
https://mail.python.org/mailman/options/python-dev/ncoghlan%40gmail.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20141106/5785f413/attachment.html>


More information about the Python-Dev mailing list