KotlinIsland / KotlinIsland/basedmypy

Allow shorthand `[T]` for `list[T]`, `{T}` for `set[T]`, and `{K: V}` for `dict[K, V]`

Open
#648 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
Python
Stars
202
Forks
6
PR merge metrics
No merged PRs in 30d

Description

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.

```python
xs: [int] = [3, 6, 1]

def f() -> {float}:
return {4.5, 7.2}

def g(d: {str: int}):
print(d)
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file, test, or entry point is named. Start by tracing the implementation of the existing `(T, U, V)` tuple shorthand through parsing and type analysis, then determine where the proposed list, set, and dict forms would be handled. Done means the examples in the issue parse and type-check with the intended types, with coverage for valid and invalid uses.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers, devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.