Adding documentation to to_zero_count function
This commit is contained in:
parent
ddc50631c8
commit
40ae6c63d4
1 changed files with 11 additions and 0 deletions
|
@ -18,6 +18,17 @@
|
||||||
|
|
||||||
|
|
||||||
def to_zero_count(page_no):
|
def to_zero_count(page_no):
|
||||||
|
"""
|
||||||
|
Will subtract 1 from the argument it gets, converting it to an int.
|
||||||
|
If the conversion fails or the argument it's negatives it returns zero instead.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
page_no: An integer
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
It returns page_no - 1 if page_no can be safely converted to an integer else it returns zero.
|
||||||
|
If page_no is negative, it returns zero.
|
||||||
|
"""
|
||||||
try:
|
try:
|
||||||
page_no = int(page_no) - 1
|
page_no = int(page_no) - 1
|
||||||
if page_no < 0:
|
if page_no < 0:
|
||||||
|
|
Loading…
Reference in a new issue