Re: [Python-ideas] [Python-Dev] nodef

[moving to python-ideas, where it belongs] On 5/23/07, Martin Blais <blais@furius.ca> wrote:
I've run into this situation several times before, and I've never felt that defining my own sentinel was unduly taxing. Having a built-in would only save a single line, the initial "sentinel = object()". Collin Winter

On 5/23/07, Collin Winter <collinw@gmail.com> wrote:
There is another benefit to a builtin 'nodef', BTW, which is that of a consistent meaning for the word. Having a consistent name for this concept--across all programs, if it were in the language--makes it more obvious what you're trying to achieve. Otherwise, you decide to use 'sentinel', I choose 'NoDef', Barry uses 'missing', and we're all speaking a different "language". Thought I do admit that the possibility of misuse of a builtin 'nodef' is slightly troubling. I guess object() is our (gensym), I did not know that. cheers,

On 24 May 2007, at 15:42, Martin Blais wrote:
Just as you find that 'None' is sometimes a valid value for a function parameter (and this is the reason why you would like 'nodef'), if there was a 'nodef' builtin you would sometimes find that it is a meaningful value for a function parameter. Would you then advocate the creation of a 'really_nodef' builtin? And then a 'this_time_i_really_mean_it_nodef' builtin? This is why a 'nodef' keyword is not a good idea. 'None' is useful because often you expect an argument of a certain type (e.g. a list, so you know it should not be 'None'). -- Arnaud

On 5/23/07, Collin Winter <collinw@gmail.com> wrote:
There is another benefit to a builtin 'nodef', BTW, which is that of a consistent meaning for the word. Having a consistent name for this concept--across all programs, if it were in the language--makes it more obvious what you're trying to achieve. Otherwise, you decide to use 'sentinel', I choose 'NoDef', Barry uses 'missing', and we're all speaking a different "language". Thought I do admit that the possibility of misuse of a builtin 'nodef' is slightly troubling. I guess object() is our (gensym), I did not know that. cheers,

On 24 May 2007, at 15:42, Martin Blais wrote:
Just as you find that 'None' is sometimes a valid value for a function parameter (and this is the reason why you would like 'nodef'), if there was a 'nodef' builtin you would sometimes find that it is a meaningful value for a function parameter. Would you then advocate the creation of a 'really_nodef' builtin? And then a 'this_time_i_really_mean_it_nodef' builtin? This is why a 'nodef' keyword is not a good idea. 'None' is useful because often you expect an argument of a certain type (e.g. a list, so you know it should not be 'None'). -- Arnaud
participants (4)
-
Arnaud Delobelle
-
Collin Winter
-
Martin Blais
-
Stephen J. Turnbull