You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -87,6 +87,8 @@ The same applies if you need the macro parts of `unpythonic` (i.e. import anythi
87
87
- Add function `isgeneric` to detect whether a callable has been declared `@generic`.
88
88
- Add function `methods`: display a list of multimethods of a generic function.
89
89
- It is now possible to dispatch on a homogeneous type of contents collected by a `**kwargs` parameter.
90
+
-`curry` now supports `@generic` functions.
91
+
- The utilities `arities`, `required_kwargs`, and `optional_kwargs` now support `@generic` functions.
90
92
- Add `unpythonic.excutil.reraise_in` (expr form), `unpythonic.excutil.reraise` (block form): conveniently remap library exception types to application exception types. Idea from [Alexis King (2016): Four months with Haskell](https://lexi-lambda.github.io/blog/2016/06/12/four-months-with-haskell/).
91
93
- Add variants of the above for the conditions-and-restarts system: `unpythonic.conditions.resignal_in`, `unpythonic.conditions.resignal`. The new signal is sent using the same error-handling protocol as the original signal, so that e.g. an `error` remains an `error` even if re-signaling changes its type.
92
94
- All documentation files now have a quick navigation section to skip to another part of the docs. (For all except the README, it's at the top.)
Copy file name to clipboardExpand all lines: doc/features.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3015,6 +3015,10 @@ The core idea can be expressed in fewer than 100 lines of Python; ours is (as of
3015
3015
3016
3016
*Docstrings of the multimethods are now automatically concatenated to make up the docstring of the generic function, so you can document each multimethod separately.*
3017
3017
3018
+
*`curry` now supports `@generic`. In the case where the **number** of positional arguments supplied so far matches at least one multimethod, but there is no match for the given combination of argument **types**, `curry` waits for more arguments (returning the curried function).*
3019
+
3020
+
**CAUTION**: *Determining whether there **could** be a match for a `@generic`is the only type checking performed by ``curry``. When using ``curry``with``@generic``or``@typed``, argument type errors are only detected when the actual call triggers - just like in code using ``curry``and traditional run-time ``isinstance`` checks. This may make it hard to debug.*
3021
+
3018
3022
*It is now possible to dispatch also on a homogeneous type of contents collected by a `**kwargs` parameter. In the type signature, use `typing.Dict[str, mytype]`. Note that in this use, the key typeis always `str`.*
3019
3023
3020
3024
The ``generic`` decorator allows creating multiple-dispatch generic functions withtype annotation syntax. We also provide some friendly utilities: ``typed`` creates a single-method generic with the same syntax (i.e. provides a compact notation for writing dynamic type checking code), and``isoftype`` (which powers the first two) is the big sister of ``isinstance``, with support for many (but unfortunately notall) features of the ``typing`` standard library module.
@@ -3036,8 +3040,6 @@ If several multimethods of the same generic function match the arguments given,
3036
3040
3037
3041
**CAUTION**: The winning multimethod is chosen differently from Julia, where the most specific multimethod wins. Doing that requires a more careful type analysis than what we have here.
3038
3042
3039
-
**CAUTION**: `@generic` does not currently work with`curry`. Adding support requires changes to the already complex logic in`curry`; it isnot high on the priority list.
3040
-
3041
3043
The details are best explained by example:
3042
3044
3043
3045
```python
@@ -3165,8 +3167,6 @@ jack(3.14) # TypeError
3165
3167
3166
3168
For which features of the ``typing`` stdlib module are supported, see ``isoftype`` below.
3167
3169
3168
-
**CAUTION**: When using ``typed``with``curry``, the type checking (and hence ``TypeError``, ifany) only occurs when the actual call triggers. Code using that combination may be hard to debug.
3169
-
3170
3170
3171
3171
#### ``isoftype``: the big sister of ``isinstance``
0 commit comments