[Python-Dev] PEP 362 Third Revision (original) (raw)
Larry Hastings larry at hastings.org
Fri Jun 15 04:34:36 CEST 2012
- Previous message: [Python-Dev] PEP 362 Third Revision
- Next message: [Python-Dev] PEP 362 Third Revision
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 06/14/2012 01:53 PM, Antoine Pitrou wrote:
* isimplemented : bool True if the parameter is implemented for use. Some platforms implement functions but can't support specific parameters (e.g. "mode" for
os.mkdir
). Passing in an unimplemented parameter may result in the parameter being ignored, or in NotImplementedError being raised. It is intended that all conditions whereisimplemented
may be False be thoroughly documented. I don't understand what the purpose of isimplemented 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')
That's oversimplified (and almost certainly not spelled correctly) but you get the general idea. os.chown will soon sprout an "fd" parameter, but it will only work on platforms where we have fchown(). Using it will result in a NotImplementedError. But some folks want to LBYL.
//arry/ -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20120614/73fd582b/attachment.html>
- Previous message: [Python-Dev] PEP 362 Third Revision
- Next message: [Python-Dev] PEP 362 Third Revision
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]