Hacker News new | ask | show | jobs
by v3ss0n 939 days ago
you aren't wrong , any is available in python 3.10 . There is no need to import typing.Any
3 comments

Those are completely different.

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.

Let's not forget ANY as in "from unittest.mock import ANY".
Whoops, I always thought I can use any as type. Damn my bad
I 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.

what? `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