KotlinIsland / KotlinIsland/basedmypy

An `Exact` annotation modifier

Open
#203 0 comments 0 reactions 0 assignees View on GitHub
feature generic modifier strict-equality
Dominant language
Python
Stars
202
Forks
6
PR merge metrics
No merged PRs in 30d

Description

```py
class A: ...
class B(A): ...
def f(a1: Exact[A], a2: A):
a1 or 1 # error
a2 or 1 # no error

f(A(), A())
f(B(), B()) # error: expected A
```
```py
class A(Generic[T]):
def __init__(t: Exact[T]): ...

A[int](1) # ok
A[int](True) # error
```
```py
def test(a: T, b: Exact[T]): ...

o: object
test(o, "a") # error, expected exactly 'object' found 'str'
```

Contributor guide

Open the contributing guide

Research direction

The issue names no repository files, tests, or entry points; begin by tracing how annotations and generic argument compatibility are checked. Use the three examples as acceptance cases, including rejecting subclasses and incompatible inferred types.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.