
On Wed, Oct 27, 2021 at 8:06 AM Erik Demaine <edemaine@mit.edu> wrote:
I wonder if it would make sense to offer a "missing argument" object (builtin? attribute of inspect.Parameter? attribute of types.FunctionType?) that actually simulates the behavior of that argument not being passed. Let me call it `_missing` for now. This would actually make it far easier to accomplish "pass in the second argument but not the first", both with early- and late-binding defaults:
``` f(_missing, {'more'}) g(_missing, {'more'}) ```
I started thinking about `_missing` when thinking about how to implement late-binding defaults. It's at least one way to do it (then the function itself could even do the argument checks), though perhaps there are simpler ways that avoid the ref count increments.
The trouble with sentinel values is that you always need another one. Sooner or later, you're going to need to talk about the _missing object, and you'll need to distinguish it from the absence of an object. If there is a way to say "don't pass this argument", it would have to be some kind of syntactic token. ChrisA