From aea328d79eba3cc7c73d270c6a20d17c769f83cf Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 29 Nov 2016 10:38:43 +0100 Subject: [PATCH 1/2] Explained how to improve the readability of long numeric literals --- components/yaml.rst | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/components/yaml.rst b/components/yaml.rst index a04ad7afe35..348c5499ddf 100644 --- a/components/yaml.rst +++ b/components/yaml.rst @@ -203,6 +203,25 @@ changed using the third argument as follows:: foo: bar bar: baz +Numeric literals +................ + +Long numeric literals, being integer, float or hexadecimal, are known for their +poor readability in code and configuration files. That's why YAML files allow to +add underscores to improve their readability: + +.. code-block:: yaml + + parameters: + credit_card_number: 1234_5678_9012_3456 + long_number: 10_000_000_000 + pi: 3.14159_26535_89793 + hex_words: 0x_CAFE_F00D + +During the parsing of the YAML contents, all the ``_`` characters are removed +from the numeric literal contents, so there is not a limit in the number of +underscores you can include or the way you group contents. + Advanced Usage: Flags --------------------- From b44cce8f139f35f3c16aeb1b443821fa73ac876f Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 8 Dec 2016 22:20:25 +0100 Subject: [PATCH 2/2] Fixed a typo --- components/yaml.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/yaml.rst b/components/yaml.rst index 348c5499ddf..56e0dedce66 100644 --- a/components/yaml.rst +++ b/components/yaml.rst @@ -203,7 +203,7 @@ changed using the third argument as follows:: foo: bar bar: baz -Numeric literals +Numeric Literals ................ Long numeric literals, being integer, float or hexadecimal, are known for their