Closed Andrej730 closed 4 months ago
This is working correctly—Vector
has no __iter__
method, so to a PEP484 type-checker it is not an Iterable
even though it is iterable. We could add a fake __iter__
method, although ideally someone that knows C++ would add it for real.
It's not possible—it would be up to the type checker to infer a more specific type from information outside the type system.
- This is working correctly—
Vector
has no__iter__
method, so to a PEP484 type-checker it is not anIterable
even though it is iterable. We could add a fake__iter__
method, although ideally someone that knows C++ would add it for real.
@Road-hog123 @nutti
Can we solve it for now by fake-implementing __iter__
? Since there are cases when you want to convert Vector
to native Python types like tuple
or list
and current typing shows false-positives and gets in the way.
@Andrej730
Yes, you can make a PR if you want.
See example below - typing errors converting Vector to tuple/list/use slices though it is actually possible.