LBYL vs EAFP

Chris Angelico rosuav at gmail.com
Tue Feb 5 00:20:19 EST 2013


On Tue, Feb 5, 2013 at 3:52 PM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> There's also the principle that it is best to raise an exception as early
> as possible. It's easier to track down errors at the point they are
> introduced than long afterwards.

Yes, definitely, especially (as was mentioned) if you're working with
callbacks. But I'd use isinstance then.

ChrisA



More information about the Python-list mailing list