Coconut v2.2.0
See Coconut's documentation for more information on all of the features listed below.
Major changes:
- #694: New
multiset
built-in based oncollections.Counter
, including new multiset literal syntax (m{1, 1, 2, 3, 3, 4}
). - #691: New
Expected
built-in based on Haskell'sEither
, plus newsafe_call
built-in that calls a function while collecting any errors into anExpected
. Additionally, theof
built-in has been renamed tocall
(of
is still available as a deprecated alias when compiled without--strict
). - #701: New
windowsof
built-in for iterating over sliding windows of the given iterable. - #688: New
cartesian_product
built-in as an enhanced version ofitertools.product
includingnumpy
support. - #690: New
cycle
built-in as an enhanced version ofitertools.cycle
. - #704, #703, #702, #693, #692: Lots of improvements to existing built-ins:
map
now supports astrict=True
keyword-only argument that works as inzip
.flatten
now supports alevels
argument for how many levels to flatten.groupsof
now supports afillvalue
argument to pad the last group.addpattern
now accepts any number of pattern-matching functions.memoize
now accepts a function to memoize as the first argument.
- #710: New
None
-aware function composition pipes (e.g.f ..?> g
).
Minor changes:
- #686: Type parameter bounds can (and should) now use
<:
syntax instead of:
or<=
(e.g.def f[T <: int[])(xs: T) -> T = ...
). - #711: Backwards
None
-aware pipes now supported (e.g.<?|
). - #708: Pattern-matching against
data
types with default arguments now allows those defaults to be elided in thematch
. - #697:
::
now produces a reiterable object when called on reiterable objects. - #706: Multiple Coconut projects should now be able to seamlessly use each other's
MatchError
s when compiled in--package
mode. - #695: Set literal syntax now supports star unpacking.
- #699: Support for
__bool__
magic method fixed on Python 2. - #687: Jupyter kernel and other automatic compilations now uses
--no-wrap
. - #685, #684: Improved detection of code issues on and off
--strict
. - #700: Some confusing unicode alternatives were removed.
- #698: Typing for
fmap
has been improved. - #689: Improved
numpy
support for some built-ins. - #705: Many Coconut built-ins have now been made
weakref
able.