Skip to content

Commit

Permalink
Update doc on interpolation validation / conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
odelalleau committed Mar 5, 2021
1 parent 94dcae5 commit a80ae95
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions docs/source/structured_config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ To work around it, use SI and II described below.
>>> assert conf.c == 100


Type validation (and implicit conversion when possible) is performed both on assignment and on values returned by interpolations, e.g:
Interpolated values are validated, and converted when possible, to the annotated type when the interpolation is accessed, e.g:

.. doctest::

Expand All @@ -350,9 +350,8 @@ Type validation (and implicit conversion when possible) is performed both on ass
omegaconf.errors.ValidationError: Value 'string' could not be converted to Integer
full_key: int_key
object_type=Interpolation
>>> cfg.str_key = 1234 # convert int to str (assignment)
>>> assert cfg.str_key == "1234"
>>> assert cfg.int_key == 1234 # convert str to int (interpolation)
>>> cfg.str_key = "1234" # string value
>>> assert cfg.int_key == 1234 # automatically convert str to int


Frozen
Expand Down

0 comments on commit a80ae95

Please sign in to comment.