Skip to content

v0.35.0

Choose a tag to compare

@freywaid freywaid released this 23 Feb 03:49
· 254 commits to master since this release

Type Restrictions

Path segments now support type restrictions to constrain which node types they apply to.

Syntax

  • :type — only apply to this type (e.g. *:dict, [0]:list)
  • :(type1, type2) — only apply to any of these types
  • :!type — exclude this type (e.g. *:!(str))
  • :!(type1, type2) — exclude multiple types (e.g. [*]:!(str, bytes))

Works on keys, slots, and attrs. Composes with filters and recursive accessor groups.

Breaking Change

Recursive traversal no longer hardcodes a skip for str and bytes. If you use custom recursive accessor groups with [*], add :!(str, bytes) to prevent character decomposition:

# Before
*(*#, [*])

# After
*(*#, [*]:!(str, bytes))

The default ** (key-only recursion) is unaffected.