This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients brett.cannon, eric.snow, gvanrossum, matrixise, ncoghlan, serhiy.storchaka
Date 2018-11-30.09:09:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1543568963.2.0.788709270274.issue35358@psf.upfronthosting.co.za>
In-reply-to
Content
'-' is not special. The import statement requires the module name been an identifier. This is just a requirement of Python syntax. But when pass the module name as a string, there is no such limitation in CPython. This is like an attribute name or keyword argument name should be identifiers in expressions, but you can pass an arbitrary string to getattr() and use a dict with arbitrary string keys as kwargs. Currently non-identifier strings are accepted, but this is an implementation detail, not a part of the language.

There are reasons against adding additional checks for attribute names and keyword argument names. This will slow down execution of all code. This is less critical for importing, because it is slower than attribute access and function call. But on other side, the benefit of adding this check is not obvious.

It may be worth to discuss this on mailing lists. First read previous discussions about attribute names and keyword argument names.
History
Date User Action Args
2018-11-30 09:09:23serhiy.storchakasetrecipients: + serhiy.storchaka, gvanrossum, brett.cannon, ncoghlan, eric.snow, matrixise
2018-11-30 09:09:23serhiy.storchakasetmessageid: <1543568963.2.0.788709270274.issue35358@psf.upfronthosting.co.za>
2018-11-30 09:09:23serhiy.storchakalinkissue35358 messages
2018-11-30 09:09:22serhiy.storchakacreate