Open pylint-bot opened 9 years ago
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?
Original comment by BitBucket: ceridwenv, GitHub: ceridwenv:
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.
Originally reported by: BitBucket: ceridwenv, GitHub: ceridwenv
With scandir now in the 3.5 stdlib and some progress on PyPy compatibility (there's a pull request at https://github.com/benhoyt/scandir/pull/53), it might be worth revisiting the use of scandir in modutils, if necessary in a conditional way.