apenwarr-redo/redo/atoi.py
Avery Pennarun 29f939013e Add a bunch of missing python docstrings.
This appeases pylint, so un-disable its docstring warning.
2018-12-14 09:03:53 +00:00

8 lines
204 B
Python

"""Simple integer conversion helper."""
def atoi(v):
"""Convert v to an integer, or return 0 on error, like C's atoi()."""
try:
return int(v or 0)
except ValueError:
return 0