3 ms·
you aren't wrong , any is available in python 3.10 . There is no need to import typing.Any
by v3ss0n 3y ago
you aren't wrong , any is available in python 3.10 . There is no need to import typing.Any
- karamanolev 3y agoThose are completely different. any - https://docs.python.org/3/library/functions.html#any https://docs.python.org/3/library/functions.html#any - Return True if any element of the iterable is true. Any - A special kind of type is Any. A static type checker will treat every type as being compatible with Any and Any as being compatible with every type.
- nicolaslem 3y agoLet's not forget ANY as in "from unittest.mock import ANY".
- v3ss0n 3y agoWhoops, I always thought I can use any as type. Damn my bad
- _ZeD_ 3y agowhat? `any` - the builtin function[0] is part of python since the dawn of time but from what I know is not usable as a type annotation, and `typing.Any` should be used (and imported explicitly) [0] https://docs.python.org/3/library/functions.html#any https://docs.python.org/3/library/functions.html#any
- BiteCode_dev 3y agoI still think callable, and iter should be usable this way. any(), probably not. The semantic is too different. But having to import Callable while callable is a built-in is a missed opportunity. I don't miss Union, Optional and List.