[Tutor] calling a superclass method after overriding it

Serdar Tumgoren zstumgoren at gmail.com
Tue Sep 22 23:56:42 CEST 2009


> I know this is a simplified example, but I'd still like to point out that
> using exceptions when there's a simple test is not reasonable.   You can
> just check for None with a simple if test.

An "if" test would be more readable, I agree.  But I was trying to
apply the "Easier to Ask Permission Forgiveness" style, discussed in
the Python Cookbook: ,

http://tinyurl.com/lfp35q

And in this recipe from the book:

http://code.activestate.com/recipes/52291/

The example Martelli uses is far more complicated than my simple use
case of checking for None, so perhaps I've engaged in a bit of
overkill? Or perhaps I'm not fully understanding the lesson. I'll
admit, the latter is very possible since I'm still on the front end of
the learning curve...


More information about the Tutor mailing list