Skip to content

Commit 3489e31

Browse files
committed
Address review comments on singleton and duck typing null
1 parent 7676a90 commit 3489e31

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
@@ -77,33 +77,28 @@ def dataframe_from_dict(data: Mapping[str, Column]) -> DataFrame:
7777

7878
class null:
7979
"""
80-
A `null` singleton object to represent missing data.
80+
A `null` object to represent missing data.
8181
82-
``null`` may be used when constructing a `Column` from a Python sequence.
83-
It supports ``is``, and does not support ``==`` and ``bool``.
82+
``null`` is a scalar, and may be used when constructing a `Column` from a
83+
Python sequence with `column_from_sequence`. It does not support ``is``,
84+
``==`` or ``bool``.
8485
85-
Methods
86-
-------
87-
__bool__
88-
__eq__
86+
Raises
87+
------
88+
TypeError
89+
From ``__eq__`` and from ``__bool__``.
90+
91+
For ``_eq__``: a missing value must not be compared for equality
92+
directly. Instead, use `DataFrame.isnull` or `Column.isnull` to check
93+
for presence of missing values.
94+
95+
For ``__bool__``: truthiness of a missing value is ambiguous.
96+
97+
Notes
98+
-----
99+
Like for Python scalars, the ``null`` object may be duck typed so it can
100+
reside on (e.g.) a GPU. Hence, the builtin ``is`` keyword should not be
101+
used to check if an object *is* the ``null`` object.
89102
90103
"""
91-
def __eq__(self):
92-
"""
93-
Raises
94-
------
95-
RuntimeError
96-
A missing value must not be compared for equality. Use ``is`` to check
97-
if an object *is* this ``null`` object, and `DataFrame.isnull` or
98-
`Column.isnull` to check for presence of missing values.
99-
"""
100-
...
101-
102-
def __bool__(self):
103-
"""
104-
Raises
105-
------
106-
TypeError
107-
Truthiness of a missing value is ambiguous
108-
"""
109-
...
104+
...

0 commit comments

Comments
 (0)