[Python-Dev] PEP 362 Third Revision (original) (raw)
Larry Hastings larry at hastings.org
Fri Jun 15 08:56:29 CEST 2012
- Previous message: [Python-Dev] PEP 362 Third Revision
- Next message: [Python-Dev] PyPI down?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 06/14/2012 11:37 PM, Victor Stinner wrote:
os.chown.signature.parameters['fd'].isimplemented = sysconfig.getconfigvar('HAVEFCHOWN') (Do you mean "fd" or "dirfd"?)
I meant "fd". "dir_fd" is contingent on fchownat(). But it was only an example anyway.
I don't like such function, how can it be portable?
I suggest that's a separate discussion; please see issue 14626.
How do you decide in your program if you can use it on any platform or not?
I can suggest two ways:
- Attempt to use it and catch NotImplementedError.
- Check the "is_implemented" flag for that parameter in the function's signature, assuming that detail is accepted as part of PEP 362.
Thank you for independently confirming the legitimacy of the use case for "is_implemented". ;-)
How do you decide if the parameter is supported or not?
Please see my example above for one plausible approach. I assume the code would look different for other implementations.
For example, some platforms may not support all available values for a parameter.
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.
//arry/ -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20120614/1465993c/attachment.html>
- Previous message: [Python-Dev] PEP 362 Third Revision
- Next message: [Python-Dev] PyPI down?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]