You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have read and followed the docs and still think this is a bug
Description
This commit introduced a check to verify that DocList is not used with an object:
if (
isinstance(item, object)
and not is_typevar(item)
and not isinstance(item, str)
and item is not Any
):
raise TypeError('Expecting a type, got object instead')
This is quite a broad condition (it breaks things like DocList[TorchTensor], or nested DocList[DocList[...]] for me for instance) as:
Almost everything will be an object so the first line if almost a catch-all.
is_typevar only checks for TypeVar objects.
Should this not check as well for something not isinstance(item, type) instead of not is_typevar to allow for classes ?
This way only non class objects (like instances of class object that are not classes themselves) will raise the TypeError.
Initial Checks
Description
This commit introduced a check to verify that DocList is not used with an object:
This is quite a broad condition (it breaks things like
DocList[TorchTensor]
, or nestedDocList[DocList[...]]
for me for instance) as:is_typevar
only checks for TypeVar objects.Should this not check as well for something
not isinstance(item, type)
instead ofnot is_typevar
to allow for classes ?This way only non class objects (like instances of class object that are not classes themselves) will raise the
TypeError
.Example Code
Python, DocArray & OS Version
Affected Components
The text was updated successfully, but these errors were encountered: