[Python-Dev] Surely "nullable" is a reasonable name?
njs at pobox.com
Mon Aug 4 12:19:38 CEST 2014
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.
On 4 Aug 2014 08:13, "Larry Hastings" <larry at hastings.org> wrote:
> 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".
> 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".
> 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
> 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:
> Most amusingly, Vala *used* to have an annotation called "(allow-none)",
> but they've broken it out into two annotations, "(nullable)" and
> 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.
> 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.
> Let the bike-shedding begin,
> Python-Dev mailing list
> Python-Dev at python.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-Dev