<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<br>
On 06/14/2012 11:37 PM, Victor Stinner wrote:<br>
<blockquote
cite="mid:CAMpsgwan_+yscPwafvD7dG4J3qZ-Kzin7GQs6W4XLFUpO=ydiA@mail.gmail.com"
type="cite">
<blockquote type="cite">
<pre wrap="">os.chown.__signature__.parameters['fd'].is_implemented =
sysconfig.get_config_var('HAVE_FCHOWN')
</pre>
</blockquote>
<pre wrap="">(Do you mean "fd" or "dirfd"?)</pre>
</blockquote>
<br>
I meant "fd". "dir_fd" is contingent on fchownat(). But it was
only an example anyway.<br>
<br>
<br>
<blockquote
cite="mid:CAMpsgwan_+yscPwafvD7dG4J3qZ-Kzin7GQs6W4XLFUpO=ydiA@mail.gmail.com"
type="cite">
<pre wrap="">I don't like such function, how can it be portable?</pre>
</blockquote>
<br>
I suggest that's a separate discussion; please see issue 14626.<br>
<br>
<br>
<blockquote
cite="mid:CAMpsgwan_+yscPwafvD7dG4J3qZ-Kzin7GQs6W4XLFUpO=ydiA@mail.gmail.com"
type="cite">
<pre wrap="">How do you decide in your program if you can use it on any platform or not?</pre>
</blockquote>
<br>
I can suggest two ways:<br>
1) Attempt to use it and catch NotImplementedError.<br>
2) Check the "is_implemented" flag for that parameter in the
function's signature, assuming that detail is accepted as part of
PEP 362.<br>
<br>
Thank you for independently confirming the legitimacy of the use
case for "is_implemented". ;-)<br>
<br>
<br>
<blockquote
cite="mid:CAMpsgwan_+yscPwafvD7dG4J3qZ-Kzin7GQs6W4XLFUpO=ydiA@mail.gmail.com"
type="cite">
<pre wrap="">How do you decide if the parameter is supported or not?</pre>
</blockquote>
<br>
Please see my example above for one plausible approach. I assume
the code would look different for other implementations.<br>
<br>
<br>
<blockquote
cite="mid:CAMpsgwan_+yscPwafvD7dG4J3qZ-Kzin7GQs6W4XLFUpO=ydiA@mail.gmail.com"
type="cite">
<pre wrap="">For example, some platforms may not support all available values for a parameter.</pre>
</blockquote>
<br>
This is the third time this has been brought up today by my count.
Rather than repeat myself, I ask that you read my remarks elsewhere
in this thread.<br>
<br>
<br>
<i>/arry</i><br>
</body>
</html>

AltStyle によって変換されたページ (->オリジナル) /