Sebastian Rittau
Sebastian Rittau
@ilevkivskyi You mean in the commit message like above?
We have a good starting point for useful protocols already in the [`_typeshed` module](https://github.com/python/typeshed/blob/master/stdlib/_typeshed/__init__.pyi). These are based on the actual need of the standard library. I see the future in...
python/typeshed#2895 is one example where this could be useful.
Is this something that could be considered? What steps are necessary to continue?
@JelleZijlstra LGTM so far, although it's unfortunate that it's difficult to distinguish between readable and read/writable buffers, but it makes sense.
> I like the `OneOf` idea. Type checkers could add a flag that makes the checker treat the type like a regular `Union`, which would provide the type safety @not-my-profile...
@gvanrossum It's late here and my brain might be a bit mushy. But aren't those orthogonal issues? `AnyOf`/`OneOf` can be useful generally in stubs in many situations. And there seems...
> I also agree that AnyOf has marginal value for static type checking. I still wonder why people think that. I believe that this clearly improves type safety in a...
This would actually reduce type safety for users that don't use strict mode. Many functions already return strict unions where it's necessary to check the return value at runtime. It's...
I don't think a `total=False` attribute would be sufficient. In the example above - in fact in all cases where I have encountered this so far - there are required...