[Python-ideas] PEP: Extended stat_result (First Draft)
Antoine Pitrou
solipsis at pitrou.net
Tue May 7 11:09:41 CEST 2013
Le Mon, 06 May 2013 19:49:44 +0200,
Pieter Nagel <pieter at nagel.co.za> a écrit :
>
> The motivation is to make "performant" code that calls stat() once
> look more similar to naive code that potentially calls it many times.
> And if naive code can say "os.path.isfile(f)" and get False even when
> f does not exist, then performant code should be able to do something
> similar by just statting and then interogating the results, without
> adding exception handling.
Then perhaps make it return None and let users write:
st = os.rich_stat(filename)
is_a_file = st and st.isfile()
(which is a rather clean and concise coding style as far as I'm humbly
concerned :-))
Regards
Antoine.
More information about the Python-ideas
mailing list