[Python-ideas] Re: Void type

2022-07-27 Thread Chris Angelico
On Thu, 28 Jul 2022 at 06:29, Lucas Wiman wrote: >> So rather than proposals for weird magic objects that do weird things >> as function arguments, I'd much rather see proposals to fix the >> reported signature, which would largely solve the problem without >> magic. (Or technically, without

[Python-ideas] Re: Void type

2022-07-27 Thread Lucas Wiman
On Wed, Jul 27, 2022 at 1:07 PM Chris Angelico wrote: > with all the variants of keyword and positional args. Being able to > say "this function has the same signature as that one, plus it accepts > consumed_arg" or "same, but without added_arg" would be extremely > useful, and short of some

[Python-ideas] Re: Void type

2022-07-27 Thread Chris Angelico
On Thu, 28 Jul 2022 at 00:08, Eric V. Smith wrote: > > Sorry for top posting: I’m on the road. > > inspect.signature can help with this. > Technically true, and a good basis for a proposal, but try designing a modified signature and you'll find that it's actually pretty hard. What I'd like to

[Python-ideas] Re: Void type

2022-07-27 Thread Lucas Wiman
Михаил Крупенков: > Yes, I want that when Void is received in a function parameter it is not processed: > > func(Void) == func() == "default" Mathew Elman: > I believe this is a rebirth of a request that has come up many times before, which is to have something like javascript's `undefined` where

[Python-ideas] Re: Void type

2022-07-27 Thread Greg Ewing
On 27/07/22 5:29 am, Stephen J. Turnbull wrote: If you're phishing, I guess worms are useful. *shudder* I think you need whorms for phishing. -- Greg ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to

[Python-ideas] Re: Void type

2022-07-27 Thread Stephen J. Turnbull
Mathew Elman writes: > To answer how this _could_ work, Undefined would be a new NoneType My example is intended to refer specifically to the alternative semantics where 'undefined' is not allowed outside of function prototypes (or other specified contexts, for that matter). The point of the

[Python-ideas] Re: Void type

2022-07-27 Thread Eric V. Smith via Python-ideas
Sorry for top posting: I’m on the road. inspect.signature can help with this. -- Eric > On Jul 27, 2022, at 9:22 AM, Chris Angelico wrote: > > On Wed, 27 Jul 2022 at 22:54, Mathew Elman wrote: >> >> Chris Angelico wrote: Again, I am not pro this idea, just answering the questions

[Python-ideas] Re: Void type

2022-07-27 Thread Chris Angelico
On Wed, 27 Jul 2022 at 22:54, Mathew Elman wrote: > > Chris Angelico wrote: > > > Again, I am not pro this idea, just answering the questions you're asking > > > as I see them :) > > Yeah. I think you're doing a great job of showing why this is a bad idea :) > > I do think the desire to fix the

[Python-ideas] Re: Void type

2022-07-27 Thread Mathew Elman
Chris Angelico wrote: > On Wed, 27 Jul 2022 at 21:54, Mathew Elman mathew.el...@ocado.com wrote: > > I don't see why you couldn't. I guess what they do depends if any of these > > have defaults? Which I think they do not in this case, right? > > If they were non vanilla dictionaries that had a

[Python-ideas] Re: Void type

2022-07-27 Thread Chris Angelico
On Wed, 27 Jul 2022 at 21:54, Mathew Elman wrote: > > I don't see why you couldn't. I guess what they do depends if any of these > have defaults? Which I think they do not in this case, right? > If they were non vanilla dictionaries that had a default e.g. > > class SomeDict(dict): > def

[Python-ideas] Re: Void type

2022-07-27 Thread Mathew Elman
I don't see why you couldn't. I guess what they do depends if any of these have defaults? Which I think they do not in this case, right? If they were non vanilla dictionaries that had a default e.g. class SomeDict(dict): def __getitem__(self, item=None): return

[Python-ideas] Re: Void type

2022-07-27 Thread Chris Angelico
On Wed, 27 Jul 2022 at 21:13, Mathew Elman wrote: > > To answer how this _could_ work, Undefined would be a new NoneType that is > falsey (just like None) can't be reassigned (just like None) and does > everything else just like None _except_ that when it is passed as a function > argument,

[Python-ideas] Re: Void type

2022-07-27 Thread Mathew Elman
To answer how this _could_ work, Undefined would be a new NoneType that is falsey (just like None) can't be reassigned (just like None) and does everything else just like None _except_ that when it is passed as a function argument, the argument name is bound to the default if it has one