News for hackers. Stuff that matters.
Re:Show HN: Python-Type-Challenges, master Python typing wit... by v3ss0n on Wednesday November 29, 2023 @05:41AM (#38457801)
you aren't wrong , any is available in python 3.10 . There is no need to import typing.Any
Re:Show HN: Python-Type-Challenges, master Python typing wit... by karamanolev on Wednesday November 29, 2023 @06:03AM (#38457951)
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.

Re:Show HN: Python-Type-Challenges, master Python typing wit... by nicolaslem on Wednesday November 29, 2023 @06:06AM (#38457976)
Let's not forget ANY as in "from unittest.mock import ANY".
Re:Show HN: Python-Type-Challenges, master Python typing wit... by v3ss0n on Thursday November 30, 2023 @11:37AM (#38475571)
Whoops, I always thought I can use any as type. Damn my bad
Re:Show HN: Python-Type-Challenges, master Python typing wit... by BiteCode_dev on Wednesday November 29, 2023 @06:16AM (#38458046)
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.

Re:Show HN: Python-Type-Challenges, master Python typing wit... by _ZeD_ on Wednesday November 29, 2023 @06:08AM (#38457991)
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