> For the complete documentation index, see [llms.txt](https://dominik1123.gitbook.io/hanna/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dominik1123.gitbook.io/hanna/fallbacks.md).

# Fallbacks

We can declare parameters to act in place of others if they are not specified. For example we can specify a circle either by its radius, diameter or circumference:

```python
from hanna import Configurable, Number

class Circle(Configurable):
    radius = Number().fallback(Number('diameter') >> (lambda x: x/2))
    
c = Circle({'radius': 5})
c.radius  # 5.0

c = Circle({'diameter': 10})
c.radius  # 5.0
```

The fallback parameter must be declared with the appropriate transformation in order to provide the original expected value (the radius in the example above).

### Syntactic sugar

Syntactic sugar for declaring fallbacks is available:

```python
class Circle(Configurable):
    radius = Number() | Number('diameter') >> (lambda x: x/2)
```
