[Tutor] question about glob.glob() implementation

Sean 'Shaleh' Perry shaleh@valinux.com
Thu, 15 Feb 2001 14:23:37 -0800


glob.glob() has a section like:

if not has_magic(basename):
        result = []
        for dirname in list:
            if basename or os.path.isdir(dirname):
                name = os.path.join(dirname, basename)
                if os.path.exists(name):
                    result.append(name)
else:

For every iteration of the for loop, basename is tested, yet its value never
changes.  Am I missing something here or is this wasteful like i think it is?