alex23 a écrit :
On Nov 24, 1:15 pm, Peng Yu pengyu...@gmail.com wrote:
Suppose that I have function f() that calls g(), I can put a test on
the argument 'x' in either g() or f(). I'm wondering what is the
common practice.
If I put the test in f(), then g() becomes more efficient when other
On Mon, 23 Nov 2009 22:27:24 -0800, alex23 wrote:
As a very rough example:
def g(x):
try:
assert isinstance(x, int)
except AssertionError:
raise TypeError, excepted int, got %s % type(x)
# ... function code goes here
def f(x):
Peng Yu wrote:
On Mon, Nov 23, 2009 at 9:44 PM, Lie Ryan lie.1...@gmail.com wrote:
Peng Yu wrote:
Suppose that I have function f() that calls g(), I can put a test on
the argument 'x' in either g() or f(). I'm wondering what is the
common practice.
My thought is that if I put the test
On Mon, 23 Nov 2009 21:15:48 -0600, Peng Yu wrote:
Suppose that I have function f() that calls g(), I can put a test on the
argument 'x' in either g() or f(). I'm wondering what is the common
practice.
My thought is that if I put the test in g(x), the code of g(x) is safer,
but the test is
On Tue, Nov 24, 2009 at 12:27 AM, alex23 wuwe...@gmail.com wrote:
On Nov 24, 1:15 pm, Peng Yu pengyu...@gmail.com wrote:
Suppose that I have function f() that calls g(), I can put a test on
the argument 'x' in either g() or f(). I'm wondering what is the
common practice.
If I put the test in
On Tue, Nov 24, 2009 at 4:58 AM, Dave Angel da...@ieee.org wrote:
Peng Yu wrote:
On Mon, Nov 23, 2009 at 9:44 PM, Lie Ryan lie.1...@gmail.com wrote:
Peng Yu wrote:
Suppose that I have function f() that calls g(), I can put a test on
the argument 'x' in either g() or f(). I'm wondering
Peng Yu wrote:
On Tue, Nov 24, 2009 at 4:58 AM, Dave Angel da...@ieee.org wrote:
I'll put an extra emphasis on this:
Your question is so open-ended as to be unanswerable.
I'll still confused by the guideline that an error should be
On Tue, 24 Nov 2009 10:14:19 -0600, Peng Yu wrote:
I'll still confused by the guideline that an error should be caught as
early as possible.
I think you are confused by what that means. It means the error should be
caught as early as possible in *time*, not in the function chain.
In Python,
Suppose that I have function f() that calls g(), I can put a test on
the argument 'x' in either g() or f(). I'm wondering what is the
common practice.
My thought is that if I put the test in g(x), the code of g(x) is
safer, but the test is not necessary when g() is called by h().
If I put the
Peng Yu wrote:
Suppose that I have function f() that calls g(), I can put a test on
the argument 'x' in either g() or f(). I'm wondering what is the
common practice.
My thought is that if I put the test in g(x), the code of g(x) is
safer, but the test is not necessary when g() is called by h().
On Mon, Nov 23, 2009 at 9:44 PM, Lie Ryan lie.1...@gmail.com wrote:
Peng Yu wrote:
Suppose that I have function f() that calls g(), I can put a test on
the argument 'x' in either g() or f(). I'm wondering what is the
common practice.
My thought is that if I put the test in g(x), the code of
On Nov 24, 1:15 pm, Peng Yu pengyu...@gmail.com wrote:
Suppose that I have function f() that calls g(), I can put a test on
the argument 'x' in either g() or f(). I'm wondering what is the
common practice.
If I put the test in f(), then g() becomes more efficient when other
code call g() and
12 matches
Mail list logo