If the default value for Unicode is traitlets.Undefined, then why is it type string when tested? How can you enforce CLI definition of an attribute if it self-massages to ""?
- Langage dominant
- Python
- Étoiles
- 653
- Forks
- 217
- Merge moyen
- 2 j 21 h
- PR mergées (30 j)
- 2
Description
The code below shows that even though `x` is never given a value, it is an empty string.
Why do [the docs](https://traitlets.readthedocs.io/en/stable/trait_types.html#traitlets.Unicode) for `Unicode` state `default_value=traitlets.Undefined` yet the type is string when tested?
```python
from traitlets.config import Application
from traitlets import List, Dict, Integer, Unicode
class App(Application):
aliases = {"x": "App.x", "y": "App.y"}
x = Unicode().tag(config=True)
y = Unicode().tag(config=True)
def start(self):
print(f"typex = {type(self.x)} val={self.x}")
print(f"y={self.y}")
if __name__ == "__main__":
App.launch_instance()
```
## Output
```python
typex = val=
y=
```
Guide de contribution
Ouvrir le guide de contribution
Évaluation
Cette issue n'a pas encore été évaluée.