Coconut v3.0.0
Coconut v3! See Coconut's documentation for more information on all of the features listed below.
Note that v3 is a major version release that comes with some breaking changes, though Coconut will do its best to warn you if your code does anything that changed from v2 to v3.
Breaking changes:
- #714:
set
patterns now work likedict
patterns where they allow extra keys, such that{1, 2}
will match{1, 2, 3}
. To get back the strict behavior, use the{1, 2, 3, *()}
pattern. Coconut will warn you if your code contains set patterns without an explicit strictness marker. - #707: the precedence of implicit function application has been changed to be compatible with implicit coefficients, such that
f x**2
is now equivalent tof(x**2)
rather thanf(x)**2
. Coconut will warn you if your code contains expressions with new precedence. - #733:
.$[]
will now only default to using an existing__getitem__
if the object is registered as acollections.abc.Sequence
.__iter_getitem__
will still always be used. Lets you do things like{"k": "v"}$[0]
. - #730:
obj.
syntax as a shorthand forgetattr$(obj)
deprecated. - #732:
--jobs
now defaults tosys
rather than0
.
New features:
- #707: New implicit coefficient syntax! Polynomials are just
a x**2 + b x + c
, with support for single variable names and numeric constants as coefficients. - #731: New
copyclosure def
functions that copy their closures on function creation, allowing them to e.g. hold on to loop variables. - #709:
(+)
syntax in a typing context now yields atyping.Protocol
that requires supporting that operator. - #709: New
&:
operator for combining multipletyping.Protocol
's into a single protocol. - #718 (thanks @yggdr!): You can now use
addpattern def
even if there's no existing function of that name, allowing you to useaddpattern def
for every pattern rather than having to usematch def
for the first one. - #727: New
x |> await
syntax for usingawait
in pipes. - #734: Substantially improved
pandas
support. - #714: New
frozenset
andmultiset
patterns.
Bugfixes:
- #725 (thanks @yggdr!): Fixed
(in)
operator function argument ordering. - #721 (thanks @yggdr!):
is not
andnot in
operator functions now supported. - #724 (thanks @Starwort!): Coconut no longer slows down
xonsh
loading and fixedxontrib unload coconut
. - #726 (thanks @caedmon-kitty!): Fixed certain
xonsh
commands when using Coconut'sxonsh
plugin. - #723:
dict
now always functions as on the latest Python 3 on any Python version. - #728 (thanks @yggdr!): Fixed
super
compatibility across Python versions and some cases wheresuper()
wouldn't work. - #717 (thanks @kksgandhi!): Fixed
coconut --jupyter qtconsole
.