---
title: "LeafSpec"
sidebar_label: "LeafSpec"
description: "The clika_runtime.pytree LeafSpec class."
---

<!-- Generated by tools/api_reference/generate_api_docs.py. Do not edit. -->

The spec of a single leaf: ``TreeSpec(*)``.

    :func:`~clika_runtime.pytree.tree_flatten` returns an instance of this class
    when the tree is a leaf, so ``isinstance(spec, LeafSpec)`` tells a lone
    value from a container.

    >>> pytree.tree_structure(3)
    TreeSpec(*)
    >>> isinstance(pytree.tree_structure(3), pytree.LeafSpec)
    True
    

## `__init__`

```python
__init__(self, *, none_is_leaf: 'bool' = True, namespace: 'str' = '') -> 'None'
```

Initialize self.  See help(type(self)) for accurate signature.
