News for hackers. Stuff that matters.
Re:Unfortunate Python by bconway on Wednesday December 21, 2011 @11:29AM (#3378021)
try treating the object as the first data type you expect, and catching the failure if that type wasn't that type, and then try the second. This allows users to create objects that are close enough to the types you expect and still use your code.

Is chaining try-catches as a trial-and-error way to figure out a type really the Right Way to do things these days?

There are no comments on this comment yet.