Skip to content

The doc of str.isalnum() should say alphanumeric(alphabetic and/or numeric) which is more clear #137266

@hyperkai

Description

@hyperkai

The doc of str.isalnum() only says alphanumeric which is less clear because we don't clearly know both of alphabetic and numeric characters or either of alphabetic or numeric characters as shown below:

Return True if all characters in the string are alphanumeric and there is at least one character, False otherwise. ...

So, the doc of str.isalnum() should say alphanumeric(alphabetic and/or numeric) which is more clear as shown below:

Return True if all characters in the string are alphanumeric(alphabetic and/or numeric) and there is at least one character, False otherwise. ...

print('abc123'.isalnum())
print('abc'.isalnum())
print('123'.isalnum())
# True

print('a b c 1 2 3'.isalnum())
print('a b c'.isalnum())
print('1 2 3'.isalnum())
# False

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions