Closed inducer closed 3 years ago
Or maybe rename (with deprecation) to is_array_container_type
?
Hm, we already have an is_array_container_type
(only used by the code generation stuff?) which mostly does the same thing as is_array_container
, but takes a class instead of an instance.
Replacing is_array_container
with "try serializing and if it works it's an array container" (that you mentioned a while back?) makes more sense to me too. A big roadblock is the code generation: how will it know what's an array container and what isn't?
A big roadblock is the code generation: how will it know what's an array container and what isn't?
What usage do you mean? I'm not sure I was able to find anything that didn't look replaceable.
What usage do you mean? I'm not sure I was able to find anything that didn't look replaceable.
Something like this?
I think we might be talking past each other. is_array_container_type
is just fine IMO. is_array_container
is bad IMO because it takes an instance and still gets it wrong.
Ah, I see! I was just worried that it created some inconsistencies in determining what's a container. Although we have some of those already, since is_array_container
can be True and serializing fails..
Either way, definitely :+1: to deprecating is_array_container
!
it created some inconsistencies in determining what's a container
The goal is the opposite! I'd like to remove the inconsistency that is_array_container
can say "yes, a numpy
array is a container", but then whoops serialization fails. At any rate, I'll PR a deprecation.
I think it's confusing because it only looks at the type. That means, for example for non-object numpy arrays, it can give the wrong answer.
cc @majosm @alexfikl