Re: inspecting a callable for the arguments it accepts

2017-11-14 Thread Chris Angelico
On Wed, Nov 15, 2017 at 4:34 PM, Gregory Ewing wrote: > Chris Angelico wrote: > > wants_one_arg.__code__.co_argcount >> >> >> 1 >> > wants_one_arg.__code__.co_varnames >> >> >> ('x',) > > > That will give you some idea, but it's not foolproof -- e.g. > if the

Re: inspecting a callable for the arguments it accepts

2017-11-14 Thread Gregory Ewing
Chris Angelico wrote: wants_one_arg.__code__.co_argcount 1 wants_one_arg.__code__.co_varnames ('x',) That will give you some idea, but it's not foolproof -- e.g. if the function has * or ** arguments, it's impossible to tell in general how many arguments it accepts without studying the

Re: inspecting a callable for the arguments it accepts

2017-11-14 Thread Cameron Simpson
On 15Nov2017 09:12, Chris Angelico wrote: On Wed, Nov 15, 2017 at 8:05 AM, Cameron Simpson wrote: I know that this isn't generally solvable, but I'm wondering if it is partially solvable. I have a task manager which accepts callables, usually functions or

Re: inspecting a callable for the arguments it accepts

2017-11-14 Thread Chris Angelico
On Wed, Nov 15, 2017 at 9:03 AM, Stefan Ram wrote: > Cameron Simpson writes: >>I would like to inspect submitted functions' signatures for suitability at >>submission time, without calling the function. For example to see if this >>function accepts

Re: inspecting a callable for the arguments it accepts

2017-11-14 Thread Chris Angelico
On Wed, Nov 15, 2017 at 8:05 AM, Cameron Simpson wrote: > I know that this isn't generally solvable, but I'm wondering if it is > partially solvable. > > I have a task manager which accepts callables, usually functions or > generators, and calls them on data items as needed. For

inspecting a callable for the arguments it accepts

2017-11-14 Thread Cameron Simpson
I know that this isn't generally solvable, but I'm wondering if it is partially solvable. I have a task manager which accepts callables, usually functions or generators, and calls them on data items as needed. For reasons which, frankly, suggest user interface ergonomics failure to me it