[Tutor] Should error checking be duplicated for both functions if one function calls another one?

David Palao dpalao.python at gmail.com
Mon Jun 1 16:33:32 CEST 2015


Hello,
Not sure if I got it, but, in my opinion functions should do only one
thing.So if function 2 finds an error, it should raise it. There
should be another function  (function 1 in your case?) taking care of
possible raised errors.

Best

2015-06-01 16:27 GMT+02:00 boB Stepp <robertvstepp at gmail.com>:
> Suppose in a given state of a program, function 1 calls function 2.
> Function 1 includes checks for possible error conditions. If there are
> no issues, then function 2 should execute with no issues as well. The
> question is, should function 2 include the error checking done in
> function 1 if function 2 is only ever called by function 1?
>
> My inclination is to say yes, as in some future incarnation of the
> program function 2 might get called in new ways. What are your
> thoughts?
>
> --
> boB
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor


More information about the Tutor mailing list