« first day (5132 days earlier)      last day (35 days later) » 

14:05
def max[T](args: list[T]) -> T:
    ...

async def amax[T](args: list[T]) -> T:
    ...

class Bag[T]:
    def __iter__(self) -> Iterator[T]:
        ...

    def add(self, arg: T) -> None:
        ...

type ListOrSet[T] = list[T] | set[T]
The docs really need a link to peps.python.org/pep-0695
There's even a new statement on the last line above docs.python.org/3/reference/simple_stmts.html#type
I love how not-Python that looks.
This looks like a caricature of Python typing
14:21
@AndrasDeak--СлаваУкраїні I heard the syntax broke typing library(s) as the T is scoped to the expression (function, class, maybe deceleration) rather than globally with the, old, standard way of defining T from TypeVar. As far as I remember people were not happy with a lot of the PEP. Kinda surprised the PEP came out so fast given the issues.
> Sponsor: Guido van Rossum <guido at python.org>
What a troll
Yeah, would explain the speed.
15:06
I don't see the problem, it's a massive upgrade compared to how typevars worked before
Narrator voice: In the year 2024, programmers realized that variables are best declared in the scope where they're relevant, rather than globally. This realization marked a significant milestone in the IT world, just like it had the previous 5823 times
3
I'd be OK with the first few lines given an explanation, but the new type statement is pure trolling.
Hmm. I'm not a huge fan of it either, but I think that's primarily because I'm already used to the current system and it's unclear what the benefit of using type is. But that's probably just a temporary issue that'll go away once it becomes the universally accepted way to define type aliases
Though... it might make it less obvious that you can access typevars and type aliases at runtime, unlike in languages like typescript
The way that it's a statement inside an assignment just rubs me the wrong way
15:30
Oh type is basically from __future__ import annotations for type aliases. I guess not using strings for all* type aliases is kinda nice.
That and it lets you use typevars
What do you mean by "typevars"? ADict: TypeAlias = dict[str, TValue] has worked for me for a while, do you mean something else?
type ListOrSet[T] = list[T] | set[T] would have to be written as a 2-liner
T = TypeVar('T')
ListOrSet = list[T] | set[T]
Ah got you. The new typevar scope stuff. Thanks

« first day (5132 days earlier)      last day (35 days later) »