basedmypy
basedmypy copied to clipboard
Allow shorthand `[T]` for `list[T]`, `{T}` for `set[T]`, and `{K: V}` for `dict[K, V]`
There's already (T, U, V) for tuple[T, U, V] and I think what I wrote is all valid syntax, so I think these shorthands are kind of the obvious way to write these types.
xs: [int] = [3, 6, 1]
def f() -> {float}:
return {4.5, 7.2}
def g(d: {str: int}):
print(d)
Interesting idea. We will discuss it at the next design meeting.
- Similar to: #449