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

[easy] Consider using scandir in modutils again #218

Open
pylint-bot opened this issue Oct 20, 2015 · 2 comments
Open

[easy] Consider using scandir in modutils again #218

pylint-bot opened this issue Oct 20, 2015 · 2 comments

Comments

@pylint-bot
Copy link
Owner

Originally reported by: BitBucket: ceridwenv, GitHub: @ceridwen?


With scandir now in the 3.5 stdlib and some progress on PyPy compatibility (there's a pull request at benhoyt/scandir#53), it might be worth revisiting the use of scandir in modutils, if necessary in a conditional way.


@pylint-bot
Copy link
Owner Author

Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore?):


Sounds good! scandir is also backported to Python 2, why is it necessary to be used in a conditional way?

@pylint-bot
Copy link
Owner Author

Original comment by BitBucket: ceridwenv, GitHub: @ceridwen?:


Because it's now in the stdlib, we have to use the same pattern as for singledispatch. If PyPy compatibility is broken too,

try:
    from os import scandir, walk
except ImportError:
    if platform.python_implementation = 'Cpython':
         from scandir import scandir, walk
    else:
         from os import walk

Or something like that.

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

No branches or pull requests

1 participant