Skip to content

Coconut v3.0.0

Compare
Choose a tag to compare
@evhub evhub released this 02 May 02:23
· 431 commits to master since this release
119c4b9

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 like dict 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 to f(x**2) rather than f(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 a collections.abc.Sequence. __iter_getitem__ will still always be used. Lets you do things like {"k": "v"}$[0].
  • #730: obj. syntax as a shorthand for getattr$(obj) deprecated.
  • #732: --jobs now defaults to sys rather than 0.

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 a typing.Protocol that requires supporting that operator.
  • #709: New &: operator for combining multiple typing.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 use addpattern def for every pattern rather than having to use match def for the first one.
  • #727: New x |> await syntax for using await in pipes.
  • #734: Substantially improved pandas support.
  • #714: New frozenset and multiset patterns.

Bugfixes:

  • #725 (thanks @yggdr!): Fixed (in) operator function argument ordering.
  • #721 (thanks @yggdr!): is not and not in operator functions now supported.
  • #724 (thanks @Starwort!): Coconut no longer slows down xonsh loading and fixed xontrib unload coconut.
  • #726 (thanks @caedmon-kitty!): Fixed certain xonsh commands when using Coconut's xonsh 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 where super() wouldn't work.
  • #717 (thanks @kksgandhi!): Fixed coconut --jupyter qtconsole.