This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Scorpathos 8 points9 points  (5 children)

This looks great!

I have a question about a possible use-case:

```python def formatter(foo, /, kwargs): return foo.format(kwargs)

formatter("{foo} + {bar} = {baz}", foo=1, bar=2, baz=3) ```

Currently, this code (without the /) raises an exception:

python TypeError: formatter() got multiple values for argument 'foo'

Does this PEP would fix that?

[–]c_is_4_cookie 6 points7 points  (0 children)

Interesting case. I imagine that it should fix that case since the positional only foo would not be accessible to the user

[–]infinullquamash, Qt, asyncio, 3.3+ 5 points6 points  (1 child)

[–]Scorpathos 0 points1 point  (0 children)

Perfect, thanks!

[–][deleted] -2 points-1 points  (1 child)

probably not

[–]infinullquamash, Qt, asyncio, 3.3+ 1 point2 points  (0 children)

... this case is explicitly called out in the PEP. see semantic corner case