File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -329,7 +329,29 @@ def __len__(cls):
329
329
330
330
class DataType (metaclass = DataTypeMeta ):
331
331
"""
332
- A collection of constants representing the different supported data types.
332
+ A collection of constants representing the different supported data types. There are three ways to compare data
333
+ types. All three are effectively the same when dealing with scalars.
334
+
335
+ Equality checking
336
+ .. code-block::
337
+
338
+ dt == DataType.TYPE
339
+ This is the most explicit form of testing and when dealing with compound data types, it recursively checks that
340
+ all of the member types are also equal.
341
+
342
+ Class checking
343
+ .. code-block::
344
+
345
+ isinstance(dt, DataType.TYPE.__class__)
346
+ This checks that the data types are the same but when dealing with compound data types, the member types are
347
+ ignored.
348
+
349
+ Compatibility checking
350
+ .. code-block::
351
+
352
+ DataType.is_compatible(dt, DataType.TYPE)
353
+ This checks that the types are compatible without any kind of conversion. When dealing with compound data types,
354
+ this ensures that the member types are either the same or :py:attr:`~.UNDEFINED`.
333
355
"""
334
356
ARRAY = _ArrayDataTypeDef ('ARRAY' , tuple )
335
357
"""
You can’t perform that action at this time.
0 commit comments