[Python-Dev] PEP 362 Third Revision
Victor Stinner
victor.stinner at gmail.com
Fri Jun 15 08:37:40 CEST 2012
>> I don't understand what the purpose of is_implemented is, or how it is
>> supposed to be computed.
>
> It's computed based on locally available functionality. Its purpose is to
> allow LBYL when using functionality that may not be available on all
> platforms. See issue 14626 for a specific use-case--which is why I pushed
> for this.
>
> When all the chips fall into place, I expect to have some code that looks
> like this:
>
> os.chown.__signature__.parameters['fd'].is_implemented =
> sysconfig.get_config_var('HAVE_FCHOWN')
(Do you mean "fd" or "dirfd"?)
I don't like such function, how can it be portable? How do you decide
in your program if you can use it on any platform or not? I prefer to
have a clear distinction between chown() et fchown() for example. So
you can simply test hasattr(os, "fchown") and decide what to do if the
function is not supported.
How do you decide if the parameter is supported or not? For example,
some platforms may not support all available values for a parameter.
Dummy example, maybe not the best one: clocks supported by
time.clock_gettime() heavily depends on the platform.
Victor
More information about the Python-Dev
mailing list