New submission from JimmyCarlos <jonathansagne...@yahoo.com>:
Hello Python Community! One feature I think would be helpful would be a method to see if a str can be safely converted into a float. Currently, this is not doable without a long regex or a try-except block, as numbers like "-3.52" contain non-numeric symbols. My suggestion is to make a new boolean method on the str class. Code-wise, it would behave quite similarly to this code: def isfloat(s:str) -> bool: try: float(s) return True except: return False I appreciate your feedback, so what do you all think? ---------- messages: 390785 nosy: JimmyCarlos priority: normal severity: normal status: open title: Add .isfloat() method to str type: enhancement _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue43808> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com