A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2009-March/087105.html below:

[Python-Dev] Approaches to argument type-checking

[Python-Dev] Approaches to argument type-checking [Python-Dev] Approaches to argument type-checkingBenjamin Peterson benjamin at python.org
Thu Mar 12 04:29:34 CET 2009
2009/3/11 Tennessee Leeuwenburg <tleeuwenburg at gmail.com>:
> Is there a general strategy used in Python development which I should be
> aware of? i.e. is it customary to type-check every argument of an interface
> method? Or is it customary not to perform type checking up-front and simply
> allow the exception to occur deeper in the code? Are there performance
> issues surrounding defensive programming?

Generally we avoid checking types at all in Python because of ducking
typing. The C interface must check types because they have to
translate to the C level equivalents.

If tests are failing from a C implementation on a Python
implementation because of extensive type checking, I would be tempted
to mark those tests as implementation details.

However, in the case of this specific issue, I think rejecting bytes
purposefully is good because it avoids programming errors.



-- 
Regards,
Benjamin
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4