Bruno Desthuilliers wrote: > Steve Holden a écrit : > (snip) >> What's the exact reason for requiring that a creator argument be of a >> specific type? So operations on the instances don't go wrong? Well, why >> not just admit that we don't have control over everything, and just *let >> things go wrong* when the wrong type is passed? > > validation isn't only about types, but that's not the point... > >> What will then happen? Why, an exception will be raised! > > Not necessarily.
Yes, that's what I'm more concerned about. As Steve says, the easy ones will cause an exception somewhere anyway but the really tricky bugs might not trouble the interpreter at all and go on to cause errors and corruption elsewhere that may not even be noticed immediately. I'm sad there's no particularly elegant alternative (an 'ensure' keyword maybe ;) as I do like how they read. I think I'll carry on using them liberally anyway, armed with the knowledge I can't rely on them in any code I distribute, and deliberately raising errors when execution NEEDS to be stopped. Thanks for the insight all. Roger. -- http://mail.python.org/mailman/listinfo/python-list