classes
classes copied to clipboard
Smart, pythonic, ad-hoc, typed polymorphism for Python
**Context.** Consider the following piece of code. ```python from classes import typeclass @typeclass def render(data_value) -> str: """Pretty-print a value.""" @render.instance(int) def _render_int(data_value: int) -> str: return f'🔢 {data_value}' render(True)...
**Context.** In order to define a default implementation (the one used if no other implementation matches), we currently have to write something like this: ```python from classes import typeclass @typeclass...
Can you provide a comparision of `classes` vs [`multipledispatch`](https://github.com/mrocklin/multipledispatch)? I see some differences at the first glance, but it would be valuable to add official, detailed information to `README.md`.
Right now our code base is ready to try this one more time. The key to success is not using `@overload`. Related https://github.com/dry-python/classes/issues/136 Related https://github.com/dry-python/classes/issues/209
After we have `delegate` in-place we can use `Literal` types. But, now they are not supported. Ideally, something like this should work: ```python from classes import typeclass, AssociatedType, Supports from...
https://github.com/python/mypy/blob/a9f3b5e5b21304c63f93e96e0bfeab2fa2945a00/mypy/nodes.py#L2353-L2357 It looks like a cleaner solution.
This should be illegal: `AssoicatedType[int]`
Right now, it is possible to create `AssociatedType` with bound type variables. This is not really supported during runtime. So, we need a check for this.
Right now we don't test `classes` with `hypothesis` at all. But, I have a great idea (at least it seems to me like so) of adding a hypothesis plugin, similar...
Hi, love the project, I've definitely wanted better mypy support in singledispatch before, as well as other more advanced features. That being said, it looks like mypy is going to...