On 06/06/2012 09:05 AM, Larry Hastings wrote:
Is there a use-case for is_implemented?
Yes, see issue 14626.
I should add, there are already some places in the standard library
where is_implemented would be relevant. The "mode" argument to os.mkdir
comes immediately to mind; on Windows it is accepted but ignored. A
counter-example would be os.symlink, which takes an extra parameter on
Windows that's *not even accepted* on other platforms.
I am utterly convinced that, when faced with these sorts of
platform-specific API differences, the first step towards sanity is to
have the API accept a consistent signature everywhere. What you do
after that is up for debate--in most cases where the parameter causes a
significant semantic change, I think specifying it with a non-default
value should throw a NotImplementedError. (With the specific case of
os.mkdir on Windows, I can agree with silently ignoring the mode; it's
not like the hapless Windows programmer could react and take a useful
alternative approach.)
Parameter objects exposing is_implemented allows LBYL in these
situations, rather than having to react to NotImplementedError.
//arry/
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com