It appears to float.is_integerbe the only "is" method with an underscore in its name among the built-in types in Python. Examples that do not include : Underline: str.isalnum, str.isalpha, str.isdecimal, str.isdigit, str.isidentifier, str.islower, str.isnumeric, str.isprintable, str.isspace, str.istitle, str.isupper.
Any clues as to why?
PEP 8 , I would expect all of these names to contain an underscore. But practicality is superior to cleanliness ( PEP 20 ), so omitting the underscore in commonly used and short names makes sense. However, both naming conventions immediately seem to be a consequence of backward compatibility (with a module loggingas a canonical example).
source
share