3 ms·
Ooh that feature was new to me. See PEP 570[1] for more details. My personal opinion is that this is not something that any code should do... but I'm not the BD
by aftbit 2y ago
Ooh that feature was new to me. See PEP 570[1] for more details. My personal opinion is that this is not something that any code should do... but I'm not the BDFL!
1: https://peps.python.org/pep-0570/ https://peps.python.org/pep-0570/
- mananaysiempre 2y agoOne case where this is very desirable: def spawn_coroutine(func, /, *args, **kwargs): # func can itself have a parameter called 'func' and nothing breaks # we could have the user provide the thunk themselves but that’s inconvenient def thunk(): return func(*args, **kwargs) # put thunk on some sort of task queue... But, as the PEP points out, sometimes you just don’t want the parameter names to be part of your public contract, and it’s nice to have a way to express that.