<p dir="ltr">I admit I spent the first half of the email scratching my head and trying to figure out what NULL had to do with argument clinic specs. (Maybe it would mean that if the argument is "not given" in some appropriate way then we set the corresponding C variable to NULL?) Finding out you were talking about None came as a surprising twist.</p>
<p dir="ltr">-n</p>
<div class="gmail_quote">On 4 Aug 2014 08:13, "Larry Hastings" <<a href="mailto:larry@hastings.org">larry@hastings.org</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<br>
<br>
Argument Clinic "converters" specify how to convert an individual
argument to the function you're defining. Although a converter
could theoretically represent any sort of conversion, most of the
time they directly represent types like "int" or "double" or "str".<br>
<br>
Because there's such variety in argument parsing, the converters are
customizable with parameters. Many of these are common enough that
Argument Clinic suggests some standard names. Examples:
"zeroes=True" for strings and buffers means "permit internal \0
characters", and "bitwise=True" for unsigned integers means "copy
the bits over, even if there's overflow/underflow, and even if the
original is negative".<br>
<br>
A third example is "nullable=True", which means "also accept None
for this parameter". This was originally intended for use with
strings (compare the "s" and "z" format units for PyArg_ParseTuple),
however it looks like we'll have a use for "nullable ints" in the
ongoing Argument Clinic conversion work.<br>
<br>
Several people have said they found the name "nullable" surprising,
suggesting I use another name like "allow_none" or "noneable". I,
in turn, find their surprise surprising; "nullable" is a term long
associated with exactly this concept. It's used in C# and SQL, and
the term even has its own Wikipedia page:<br>
<blockquote><a href="http://en.wikipedia.org/wiki/Nullable_type" target="_blank">http://en.wikipedia.org/wiki/Nullable_type</a><br>
</blockquote>
Most amusingly, Vala *used* to have an annotation called
"(allow-none)", but they've broken it out into two annotations,
"(nullable)" and "(optional)".<br>
<blockquote><a href="http://blogs.gnome.org/desrt/2014/05/27/allow-none-is-dead-long-live-nullable/" target="_blank">http://blogs.gnome.org/desrt/2014/05/27/allow-none-is-dead-long-live-nullable/</a><br>
</blockquote>
<br>
Before you say "the term 'nullable' will confuse end users", let me
remind you: this is not user-facing. This is a parameter for an
Argument Clinic converter, and will only ever be seen by CPython
core developers. A group which I hope is not so easily confused.<br>
<br>
It's my contention that "nullable" is the correct name. But I've
been asked to bring up the topic for discussion, to see if a
consensus forms around this or around some other name.<br>
<br>
Let the bike-shedding begin,<br>
<br>
<br>
<i>/arry</i><br>
</div>
<br>_______________________________________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org">Python-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-dev" target="_blank">https://mail.python.org/mailman/listinfo/python-dev</a><br>
Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/njs%40pobox.com" target="_blank">https://mail.python.org/mailman/options/python-dev/njs%40pobox.com</a><br>
<br></blockquote></div>