Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module names are too restrictive #127

Open
tfcollins opened this issue May 1, 2021 · 3 comments
Open

Module names are too restrictive #127

tfcollins opened this issue May 1, 2021 · 3 comments

Comments

@tfcollins
Copy link

def _check_specials_characters(s):

I think this check is too restrictive as Python modules should be able to contain numbers just not start with them. PEP8 isn't super clear though: https://www.python.org/dev/peps/pep-0008/#package-and-module-names

@alexcjohnson
Copy link
Collaborator

Good catch @tfcollins - we should certainly accept numbers after the first character. Feel like making a PR?

In fact I don't think even the lowercase restriction is necessary, just conventional. I believe any Python identifier is valid as a module name, ie [a-zA-Z_][a-zA-Z0-9_]*. That said I don't see any prominent examples of uppercase letters in module names whereas numbers do appear from time to time, so just adding numbers is probably the right thing to do here.

@tfcollins
Copy link
Author

I'll try to put together a PR in a few days. Based on my reading a PEP8 I'll change the check to assume all lowercase, cannot start with a number, and underscores cannot be on either end of name.

-Travis

@elda27
Copy link

elda27 commented Feb 10, 2022

Any update here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants