New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Release v2.0.0 [How Not to Be Seen] #671
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TODO: Once Coconut v2 is released, Coconut should be added to |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Coconut v2 is here! See Coconut's documentation for more information on all of the features listed below.
Breaking changes:
x is int
type-checking syntax is now deprecated in favor of using theint(x)
class pattern. For cases where there is now rewriting as a class pattern,x `isinstance` int
syntax is also supported.{"a": a}
now matches a dictionary with at least"a"
as a key rather than exactly"a"
as its only key to be consistent with Python 3.10. Coconut will warn if such syntax is detected and suggest the explicit{"a": a, **_}
or{"a": a, **{}}
syntax instead.data
types should not add and multiply like tuples #639: Coconutdata
types no longer support adding or multiplying them like tuples unless explicitly added via__add__
/__mul__
methods.fmap
over adict
shouldmap
over the items, notstarmap
#623:fmap
over a Mapping (e.g.dict
) now does a normal map instead of astarmap
. Thus, you'll need to dofmap$(def ((k, v)) -> (new_k, new_v))
instead offmap$((k, v) -> (new_k, new_v))
. Old behavior can also be recovered withfmap$(starmap_over_mappings=True)
.($[])
spelling for the iterator slicing operator function has been removed in favor of.$[]
and the normal getitem operator has been added as.[]
...
has been lowered such thatf x .. g y
is now equivalent to(f x) .. (g y)
rather than((f x) .. g) y
.initializer
toinitial
inscan
signature to matchreduce
#635:initializer
keyword argument inscan
changed toinitial
to match the function signature ofreduce
.New language features:
[a ; a]
, write out 2D array literals as[1, 2;; 3, 4]
, with the number of semicolons denoting the axis from the end on which to concatenate.(.+1)
,(a+.)
,(.<|x)
, including support for custom operators as(.
plusx)
.x: typing.Tuple[int, str]
, just:x: (int; str)
.for
loops #633: New pattern-matching for loops, allowing for arbitrary destructuring pattern-matching in for loops.(a=1, b=2)
.func$(kwd_arg=?)
.lift
to "lift" a function up so that its arguments become unary functions. Also: ident, flip, const, of.all_equal
andcollectby
built-ins for working with iterables.fmap
now supports asynchronous iterators.=<expr>
has been deprecated in favor of==<expr>
; the former syntax will now raise an error in--strict
mode..attr=<match>
syntax that raises an error if theattr
isn't present rather than failing the match.[1] + x + [2] + y + [3]
).as x
(to explicitly bind a variable) andis x
(to do an identity check) pattern-matching constructs.a `pred` or b = <expr>
syntax that binds toa
ifpred
andb
otherwise.jax
support infmap
and multidimensional array literal/concatenation.(,)
for joining arguments into a tuple and new(raise)
operator function for raising an exception.@
now supported on all Python versions.super()
now supported on all Python versions.typing
imports intotyping_extensions
imports when necessary.:=
assignment expressions can now be chained without parentheses.New compiler features:
xontrib
in thexonsh
shell to enable Coconut syntax.papermill
.coconut[kernel]
installation option for a lightweight Coconut + Jupyter kernel dependencies install #629 (thanks @tbsexton!): Newcoconut[kernel]
installation option for installing only lightweight Jupyter kernel dependencies compared to the full support offered bycoconut[jupyter]
.coconut.convenience
API.Bugfixes:
coconut --watch
for watching files for changes to be recompiled fixed.unexpected keyword argument cell_id
#657 (thanks @tbsexton!): Jupyter kernel compatibility with new Jupyter/IPython versions fixed.numpy
arrays by registering them as Sequences.fmap
for different input types with pattern matching #653 (thanks @fakuivan!): Fixed dotted names in class/data patterns.