[Python-ideas] PEP: Extended stat_result (First Draft)
Antoine Pitrou
solipsis at pitrou.net
Mon May 6 14:38:45 CEST 2013
Le Mon, 06 May 2013 14:29:27 +0200,
Pieter Nagel <pieter at nagel.co.za> a écrit :
> On Mon, 2013-05-06 at 11:30 +0200, Antoine Pitrou wrote:
>
> > I don't really understand the point of a null object here, since
> > os.stat() will raise when called on a non-existent patch.
>
> The point is that I am proposing to (optionally) change the behaviour
> of os.stat(), so they will *not* raise when the path is non-existent,
> but instead will return a null object.
I don't really think that's satisfactory:
1. it's making the API more complicated
2. None should really be returned, not a "null object"
3. other os functions which expect a file will raise when passed a
non-existing path, not return a "null object"
I understand why you would like to do that, but IMO the problems above
outweigh the advantages.
If we were designing os.stat() right now, perhaps returning None would
be ok. But I don't think a "null object" is a good proposition.
Regards
Antoine.
More information about the Python-ideas
mailing list