What's the best way to minimize the need of run time checks?

Chris Angelico rosuav at gmail.com
Tue Aug 9 21:02:07 EDT 2016


On Wed, Aug 10, 2016 at 10:58 AM, Juan Pablo Romero Méndez
<jpablo.romero at gmail.com> wrote:
>> I don't check for file-likeness in the application code. If somehow a
>> non-file-like (file-unlike?) object makes its way into my function, I
>> expect (and hope) my program will immediately stop and print a nice
>> traceback for me. If I wanted some other behavior, I probably would already
>> have try/except surrounding the appropriate section to deal with not-found
>> or permissions errors. If I need to, I'll add TypeError and AttributeError
>> to that except statement.
>>
>>
> This is interesting. You are Ok having runtime errors?

Absolutely. In real terms, there's no difference between "compile-time
error" and "run-time error that you trigger the moment you run your
program".

ChrisA



More information about the Python-list mailing list