I think we typically prefer list comprehensions in cases like this. I think the following is equivalent: `[os.path.abspath(basedir) for basdir in basedirs if os.path.isdir(basedir)]`