KotlinIsland / KotlinIsland/basedmypy

Denotability for storing / not storing references

Open
#411 0 comments 0 reactions 0 assignees View on GitHub
feature
Dominant language
Python
Stars
202
Forks
6
PR merge metrics
No merged PRs in 30d

Description

# Search terms
ownership, variance

#410 would benefit from knowledge regarding ownership (ie, if something keeps references to something)

```py
def foo() -> Unowned[list[str]]:
return [""] # no error
def bar(b: Owns[list[list[str]]]) -> Unowned[list[str]]:
return b[0] # error: this value is owned
result = []
b.append[result] # note: ownership taken here
return result # error: is value is owned

a: list[object] = foo() # no error
```

things will be stored by default?

Contributor guide

Open the contributing guide

Research direction

Begin with issue #410 and the ownership and variance examples in this issue. Determine and specify whether references are stored by default, including the expected outcomes for foo, bar, and the list assignment. Done means the ownership behavior is clearly defined and its examples are covered by appropriate tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.