[Python-Dev] Re: How to specify optional support of arguments

2020-06-19 Thread Jim J. Jewett
Even without platform differences, limits on the value of parameters really ought to be in the docstring, which is available to inspect. If you're asking for a more specific convention that could actually be used, that still probably still needs to be written. __

[Python-Dev] Re: How to specify optional support of arguments

2020-06-15 Thread Emily Bowman
Isn't it more Pythonic to simply call the function and an alternative path to handle the exception, anyway? Half of os needs to be tested for NotImplementedError or OSError if it's going to run anywhere outside the development environment anyway, otherwise you're stuck with only the most basic func

[Python-Dev] Re: How to specify optional support of arguments

2020-06-15 Thread Guido van Rossum
IMO it is up to the offending module to provide an API for advertising which variant of those functions is accepted. This seems out of scope for inspect. On Sun, Jun 14, 2020 at 23:16 Ivan Pozdeev via Python-Dev < python-dev@python.org> wrote: > > On 15.06.2020 8:45, Serhiy Storchaka wrote: > > 1

[Python-Dev] Re: How to specify optional support of arguments

2020-06-14 Thread Serhiy Storchaka
15.06.20 04:06, Greg Ewing пише: Instead of a bunch of ad-hoc mechanisms for finding out about platform-dependent arguments, maybe there should be a function in the inspect module for testing whether a function has a given argument. Then you could say something like    if inspect.hasargument(gl

[Python-Dev] Re: How to specify optional support of arguments

2020-06-14 Thread Ivan Pozdeev via Python-Dev
On 15.06.2020 8:45, Serhiy Storchaka wrote: 14.06.20 23:45, Ivan Pozdeev via Python-Dev пише: 1. The documentation clearly says that it's supported depending on OS flavor -- so if I want to know if I can supply it, I need to rather check `os.name`. Those members are thus redundant. If th

[Python-Dev] Re: How to specify optional support of arguments

2020-06-14 Thread Serhiy Storchaka
14.06.20 23:45, Ivan Pozdeev via Python-Dev пише: 1. The documentation clearly says that it's supported depending on OS flavor -- so if I want to know if I can supply it, I need to rather check `os.name`. Those members are thus redundant.     If the distinction is finer than os.name then I'd

[Python-Dev] Re: How to specify optional support of arguments

2020-06-14 Thread Greg Ewing
Instead of a bunch of ad-hoc mechanisms for finding out about platform-dependent arguments, maybe there should be a function in the inspect module for testing whether a function has a given argument. Then you could say something like if inspect.hasargument(glob.glob, 'dir_fd'): ... -- G

[Python-Dev] Re: How to specify optional support of arguments

2020-06-14 Thread Ivan Pozdeev via Python-Dev
(see an answer to the OP's specific question below) I don't quite get the point for .supports_stuff. It seems well-intentioned but misguided. 1. The documentation clearly says that it's supported depending on OS flavor -- so if I want to know if I can supply it, I need to rather check `os.name