2009/3/11 Tennessee Leeuwenburg <tleeuwenb...@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 _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com