Unpythonic

Latest version: v0.15.1

Safety actively analyzes 625251 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 4 of 7

0.9.0

- **Macros!** New module `unpythonic.syntax`, adding syntactic macros for constructs where this improves usability. See [`macro_extras`](macro_extras/) for documentation.
- Notable macros include `curry` (automatic currying for Python) and `cond` (multi-branch conditional expression, usable in a lambda), and macro variants of the `let` constructs (no boilerplate).
- As of this writing, requires the [latest MacroPy3](https://github.com/azazel75/macropy) from git HEAD.
- Not loaded by default. To use, `from unpythonic.syntax import macros, ...`.
- Include generic MacroPy3 bootstrapper for convenience, to run macro-enabled Python programs.
- Fix bug in let constructs: should require unique names in the same `let`/`letrec`.
- Fix bug in `unpythonic.fun.apply`.

---

0.8.8

Changes:

- ``curry``: by default, ``TypeError`` if args remaining when exiting top-level curry context
- add dynvar ``curry_toplevel_passthrough`` to switch the error off
- ``rotate`` now conceptually shifts the arg slots, not the values; this variant seems easier to reason about.
- accept just tuple (not list) as the pythonic multiple-return-values thing in ``curry``, ``compose``, ``pipe``

New:

- add ``make_dynvar``, to set a default value for a dynamic variable. Eliminates the need for ``if 'x' in dyn`` checks.
- as an optional extra, add a [MacroPy3](https://github.com/azazel75/macropy) based autocurry macro, which automatically curries all function calls that lexically reside in a ``with curry`` block. (Make your Python look somewhat like Haskell.)

Bugfixes/optimizations:

- ``nth``: fix off-by-one bug
- ``dyn``: skip pushing/popping a scope if no bindings given

---

0.8.7

Changes:

- `scanr` now syncs the left ends of multiple inputs, as it should.
- robustness: add a typecheck to `ShadowedSequence.__init__`
- rename: for consistency with `rscanl`, `rfoldl`, the new names of *sync right ends of multiple inputs, then map/zip from the right*, are `rmap`, `rzip`.
- `llist`, `lreverse` are now more ducky/pythonic.

New:

- add `rscanl`, `rscanl1`, `rfoldl`, `rreducel`: reverse each input, then left-scan/left-fold. This approach syncs the right ends if multiple inputs.
- add `mapr`, `zipr` (map-then-reverse): sync left ends of multiple inputs, then map/zip from the right.
- add convenience function `rev`: try `reversed(...)`, if `TypeError` then `reversed(tuple(...))`
- add `butlast`, `butlastn`, `partition`

---

0.8.6

New features:

- add `unfold`, `unfold1`: generate a sequence corecursively
- add memoization for iterables (`imemoize`, `fimemoize`)

Enhancements:

- `call` now accepts also args (see docstring)
- gtco: allow tail-chaining into any iterable
- document new features in README (also those from 0.8.5)

Bugfixes:

- fix bugs in gtco
- strip trampolines correctly in nested generator-TCO chains
- fix handling of generator return values

---

0.8.5

- add `gtrampolined`: TCO (tail chaining) for generators
- add `gmemoize`: memoization for generators
- bring convenience features of `dyn` to parity with `env`

---

0.8.4

- Parameterize scan and fold; can now terminate on longest input
- Add `map_longest`, `mapr_longest`, `zipr_longest`
- `unpack` is now curry-friendly

Technical enhancements:

- refactor `unpythonic.it` to use `itertools` where possible
- remove unnecessary conversions from iterator to generator

---

Page 4 of 7

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.