Skip to content

Commit 9b71c27

Browse files
committed
Address review comments on singleton and duck typing null
1 parent cb1c99a commit 9b71c27

File tree

1 file changed

+21
-26
lines changed

1 file changed

+21
-26
lines changed

spec/API_specification/dataframe_api/__init__.py

+21-26
Original file line numberDiff line numberDiff line change
@@ -17,33 +17,28 @@
1717

1818
class null:
1919
"""
20-
A `null` singleton object to represent missing data.
20+
A `null` object to represent missing data.
2121
22-
``null`` may be used when constructing a `Column` from a Python sequence.
23-
It supports ``is``, and does not support ``==`` and ``bool``.
22+
``null`` is a scalar, and may be used when constructing a `Column` from a
23+
Python sequence with `column_from_sequence`. It does not support ``is``,
24+
``==`` or ``bool``.
2425
25-
Methods
26-
-------
27-
__bool__
28-
__eq__
26+
Raises
27+
------
28+
TypeError
29+
From ``__eq__`` and from ``__bool__``.
30+
31+
For ``_eq__``: a missing value must not be compared for equality
32+
directly. Instead, use `DataFrame.isnull` or `Column.isnull` to check
33+
for presence of missing values.
34+
35+
For ``__bool__``: truthiness of a missing value is ambiguous.
36+
37+
Notes
38+
-----
39+
Like for Python scalars, the ``null`` object may be duck typed so it can
40+
reside on (e.g.) a GPU. Hence, the builtin ``is`` keyword should not be
41+
used to check if an object *is* the ``null`` object.
2942
3043
"""
31-
def __eq__(self):
32-
"""
33-
Raises
34-
------
35-
RuntimeError
36-
A missing value must not be compared for equality. Use ``is`` to check
37-
if an object *is* this ``null`` object, and `DataFrame.isnull` or
38-
`Column.isnull` to check for presence of missing values.
39-
"""
40-
...
41-
42-
def __bool__(self):
43-
"""
44-
Raises
45-
------
46-
TypeError
47-
Truthiness of a missing value is ambiguous
48-
"""
49-
...
44+
...

0 commit comments

Comments
 (0)