Skip to content

Commit

Permalink
Merge pull request #3 from curegit/readme
Browse files Browse the repository at this point in the history
Add readme draft
  • Loading branch information
curegit authored Oct 24, 2023
2 parents 03067bb + 2a2a13c commit 97ca594
Showing 1 changed file with 57 additions and 1 deletion.
58 changes: 57 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,60 @@
# Reification (Python package)
# Reification (Python library)


```py
from reification import Reified

class ReifiedList[T](Reified): pass

l = ReifiedList[int]([1, 2, 3])

print(l.types) # int
```

## Requirements

Python >= 3.12

Any non-builtin modules are NOT required.

## Install

```sh
pip3 install reification
```

## Usage

```py
>>> from reification import reify
>>> a = reify[list[int]]([1, 2, 3])
>>> a.type
list[int]
```

```py
T = TypeVar("T")

class CheckedStack(Reific[T]):

```

```py
>>> int_stack = CheckedStack[int]()
>>> isinstance(int_stack, CheckedStack[int])
True
>>> isinstance(int_stack, CheckedStack[str])
False
```

subclass works as you expected.

```py
>>> issubclass(Reified[int], Reified[int])
>>> issubclass(Reified, Reified[int])
>>> issubclass(Reified[int], Reified)
>>> issubclass(Reified[str], Reified[int])
```

## License

Expand Down

0 comments on commit 97ca594

Please sign in to comment.