On 2009-07-02, Paul Rubin <http> wrote: > Tim Harig <user...@ilthio.net> writes: >> If lower is 5 and higher is 3, then it returns 3 because 3 != None in the >> first if. > Sorry, the presumption was that lower <= higher, i.e. the comparison > had already been made and the invariant was enforced by the class > constructor. The comment should have been more explicit, I guess.
That being the case, it might be a good idea either to handle the situation and raise an exception or add: assert self.lower <= self.higher That way an exception will be raised if there is an error somewhere else in the code rather then silently passing a possibly incorrect value. -- http://mail.python.org/mailman/listinfo/python-list