Sebastian Rittau

Results 518 comments of Sebastian Rittau

It's a bit weird that `SupportsGetItem` also requires `__contains__` as this conflicts with our usual naming policy. This was probably done to support the old-style iteration protocol for container checks,...

#11825 shows that there's only one place in the stdlib that actually meant to use the existing `SupportsGetItem`, while there are multiple places that only require `__getitem__`.

`SupportsGetItem` is marked as "stable", so I'm wary changing it without a deprecation process. It would be much easier, of course.

Checking the third-party stubs, I only found one place where `SupportsContainsAndGetItem` would be used and several where `SupportsGetItem` would be correct.

Let's try this after `SupportsContainsAndGetItem` has made it into type checkers.

I need to look at this in depth at some point.

I'd say fairly safe, with only few false positives, are: * Function arguments that contain a union with `Any`. (But not return types.) * Fields that contain `Any`, either standalone...

The only thing I'm a bit uneasy about is changing `Any | None` return types, because they are fairly common workarounds for the missing permissive union type, and they are...

> We now have `MaybeNone` for those ! I had the same thought while just reading through this thread again. :) Since our current policy asks for all `Any`s to...