On Wed, Oct 12, 2016 at 12:25:16AM +0000, Elliot Gorokhovsky wrote:

> Regarding generalization: the general technique for special-casing is you
> just substitute all type checks with 1 or 0 by applying the type assumption
> you're making. That's the only way to guarantee it's safe and compliant.

I'm confused -- I don't understand how *removing* type checks can 
possible guarantee the code is safe and compliant.

It's all very well and good when you are running tests that meet your 
type assumption, but what happens if they don't? If I sort a list made 
up of (say) mixed int and float (possibly including subclasses), does 
your "all type checks are 1 or 0" sort segfault? If not, why not? 
Where's the safety coming from?

By the way, your emails in this thread have reminded me of a quote from 
the late Sir Terry Pratchett's novel "Maskerade" (the odd spelling is 

    "What sort of person," said Salzella patiently, "sits down and
    *writes* a maniacal laugh? And all those exclamation marks, you
    notice? Five? A sure sign of someone who wears his underpants
    on his head."


Python-ideas mailing list
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to