Filename type (Was: Re: finding file size)

Just just at
Sat Jan 3 13:27:38 CET 2004

In article <mailman.45.1073125105.12720.python-list at>,
 Gerrit Holl <gerrit at> wrote:

> I propose to add a "filename" type to Python.
[ ... ]
> A different solution to this problem would be to introduce "filename"
> type to Python, a subclass of str. The "name" attribute of file would be of 
> this
> type. This type would inherit a lot of os.path stuff: getsize becomes
> simpler, more readable, and more object oriented, as do other os.path
> functions. I think the alternatives look a lot more prety:
> OLD                                         NEW
> os.path.realpath(fn)                        fn.realpath()
> os.path.getmtime(         
> os.path.ismount(os.path.dirname(
> It's more beatiful, simpler, flatter (#3), practical, obvious, easy.

This has been proposed a few times, and even implemented at least once:

I'm very much in favor of adding such an object, but I don't like Jason 
Orendorff's design all that much. There has been a discussion about it 
in the past:


More information about the Python-list mailing list