Quote:
Originally Posted by pchrist7
Hi Chaley
I got ambicious. Tried to modify the function code. Want to learn.
|
I know that feeling. That is why I did the function in the first place
Quote:
Got a weird idea that f > 0 and f < test_val should return Reading,
tried with elif since python apparently doesn't have "case"
...
code:
def evaluate(self, formatter, kwargs, mi, locals, val, is_read_pct, is_read_str,
is_not_read_str, no_page_read_str, is_reading_str):
|
The only difference between your code and mine is that yours returns a different string if the value == 0.
The re.match only succeeds when an annotation is found. That means that the % will be a valid number. Your change returns 'is_reading_str' if that number is > 0 (you know that), and is_not_read_str if that number == 0.
My question: can the number ever be zero? That would imply that the book had been opened but no pages had been turned?