#πŸ”’ Positional only `/` marker, bug?

10 messages Β· Page 1 of 1 (latest)

tepid umbra
#

Hello there, I'm writing a new blog post about some techniques for argument processing, the usual *args, **kw ... and I wanted to talk about keywork only and positional only arguments (https://docs.python.org/3/tutorial/controlflow.html#positional-or-keyword-arguments) and I think I fell onto a ~ring of fire~ bug.

given

def min(a, b, c, /):
  return min((a,b,c))

the following call fails

>>> min(1,2,3)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 2, in min
TypeError: min() missing 2 required positional arguments: 'b' and 'c'

It's weird, isn't it?

My python version

➜  ~ python3 --version
Python 3.10.12
old flowerBOT
#

@tepid umbra

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

storm ingot
tepid umbra
#

Hmmm

#

oh my

#

I wanted to call the builtin and I brainfarted

#

Ok Solved, thanks πŸ˜‰

storm ingot
#

!close

old flowerBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.