Michael Hoffman wrote: > Reinhold Birkenfeld wrote: >> FYI: I modified the path module a bit so that it fits many of the suggestions >> from python-dev, and put the result in the Python CVS tree under >> nondist/sandbox/path. >> >> Most prominent change is that it doesn't inherit from str/unicode anymore. >> I found this distinction important, because as a str subclass the Path object >> has many methods that don't make sense for it. > > Having path descend from str/unicode is extremely useful since I can > then pass a path object to any function someone else wrote without > having to worry about whether they were checking for basestring. I think > there is a widely used pattern of accepting either a basestring[1] or a > file-like object as a function argument, and using isinstance() to > figure out which it is.
Where do you see that pattern? IIRC it's not in the stdlib. > What do you gain from removing these methods? A smaller dir()? It made sense to me at the time I changed this, although at the moment I can't exactly recall the reasons. Probably as Terry said: a path is both a list and a string. Reinhold -- http://mail.python.org/mailman/listinfo/python-list