[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

[Python-ideas] Re: Void type

2022-07-26 Thread Stephen J. Turnbull
Mathew Elman writes: > 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 it means "use the default value" if passed to a > function that has a default value or "value not provided" (slightly >

[Python-ideas] Re: Void type

2022-07-26 Thread Chris Angelico
On Tue, 26 Jul 2022 at 19:37, Mathew Elman wrote: > > 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 it means "use > the default value" if passed to a function that has a default value or "value >

[Python-ideas] Re: Void type

2022-07-26 Thread 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 it means "use the default value" if passed to a function that has a default value or "value not provided" (slightly different to "None"). >> def foo(x,

[Python-ideas] Re: Void type

2022-07-25 Thread Anthony Flury via Python-ideas
use None - that is effectively what you need. unless of course None is valid in your data set. -- Anthony Flury email : anthony.fl...@btinternet.com Twitter : @TonyFlury > On Jul 25, 2022, at 10:43 AM, Михаил Крупенков wrote: > >  > Yes, I want that when Void is received in a function

[Python-ideas] Re: Void type

2022-07-25 Thread João Santos
You can easily achieve this with something like Void = object() def func(param=Void):   if param is Void:     param = "default" or in the wrapper: Void = object() def wrapper(param=Void, **kwargs):   if param is not Void:     kwargs["param"] = param   return func(**kwargs) With some

[Python-ideas] Re: Void type

2022-07-25 Thread Chris Angelico
On Mon, 25 Jul 2022 at 19:41, Михаил Крупенков wrote: > > Yes, I want that when Void is received in a function parameter it is not > processed: > > func(Void) == func() == "default" It's very difficult to follow this topic because each of your posts begins a completely new thead, with no

[Python-ideas] Re: Void type

2022-07-25 Thread Михаил Крупенков
Yes, I want that when Void is received in a function parameter it is not processed: func(Void) == func() == "default" ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org

[Python-ideas] Re: Void type

2022-07-24 Thread Paul Bryan
It's unclear to me what `Void` is meant to provide in your example. Is your hope for a `Void` value to not be passed as a parameter to the wrapped function?  On Sun, 2022-07-24 at 17:55 +, Крупенков Михаил wrote: > Hello, I'll give an example: > > def func(param="default"): >     ... > >