From 65e78cfc1eb1afba71de55fef94306bb5599421d Mon Sep 17 00:00:00 2001 From: Mariatta Wijaya Date: Mon, 27 Mar 2017 22:08:36 -0700 Subject: [PATCH 1/6] bpo-29928: Add f-string to the Glossary --- Doc/glossary.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Doc/glossary.rst b/Doc/glossary.rst index 495934afe74c8b..57c61ce4dccfb3 100644 --- a/Doc/glossary.rst +++ b/Doc/glossary.rst @@ -320,6 +320,21 @@ Glossary A module written in C or C++, using Python's C API to interact with the core and with user code. + f-string + Short for :dfn:`formatted string literal`, which is string literal + that is prefixed with ``'f'`` or ``'F'``. f-strings contain + replacement fields, which are expressions delimited by curly braces + ``{}``. For example:: + + >>> name = "Fred" + >>> f"He said his name is {name!r}." + "He said his name is 'Fred'." + >>> f"He said his name is {repr(name)}." + "He said his name is 'Fred'." + + See also :pep:`498`, the proposal that added formatted string literals, + and the :ref:`documentation `. + file object An object exposing a file-oriented API (with methods such as :meth:`read()` or :meth:`write()`) to an underlying resource. Depending From 78deabb131942be7dce58f20377789802919c23b Mon Sep 17 00:00:00 2001 From: Mariatta Date: Tue, 28 Mar 2017 09:31:10 -0700 Subject: [PATCH 2/6] 'which is a string literal' --- Doc/glossary.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/glossary.rst b/Doc/glossary.rst index 57c61ce4dccfb3..d18779aa6f3b09 100644 --- a/Doc/glossary.rst +++ b/Doc/glossary.rst @@ -321,7 +321,7 @@ Glossary core and with user code. f-string - Short for :dfn:`formatted string literal`, which is string literal + Short for :dfn:`formatted string literal`, which is a string literal that is prefixed with ``'f'`` or ``'F'``. f-strings contain replacement fields, which are expressions delimited by curly braces ``{}``. For example:: From 6bdfe608063fd1fb38d14f2ded6c3f2efa6e638b Mon Sep 17 00:00:00 2001 From: Mariatta Date: Wed, 29 Mar 2017 11:32:16 -0700 Subject: [PATCH 3/6] Capitalize F --- Doc/glossary.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/glossary.rst b/Doc/glossary.rst index d18779aa6f3b09..85ff66a1a8adfd 100644 --- a/Doc/glossary.rst +++ b/Doc/glossary.rst @@ -322,7 +322,7 @@ Glossary f-string Short for :dfn:`formatted string literal`, which is a string literal - that is prefixed with ``'f'`` or ``'F'``. f-strings contain + that is prefixed with ``'f'`` or ``'F'``. F-strings contain replacement fields, which are expressions delimited by curly braces ``{}``. For example:: @@ -332,8 +332,8 @@ Glossary >>> f"He said his name is {repr(name)}." "He said his name is 'Fred'." - See also :pep:`498`, the proposal that added formatted string literals, - and the :ref:`documentation `. + See also the documentation for :ref:`f-strings `, and :pep:`498`, + the proposal that them. file object An object exposing a file-oriented API (with methods such as From ca861481443808314c98bee30ae67cb9ca1e8bad Mon Sep 17 00:00:00 2001 From: Mariatta Date: Wed, 29 Mar 2017 11:32:57 -0700 Subject: [PATCH 4/6] missing word 'added' --- Doc/glossary.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/glossary.rst b/Doc/glossary.rst index 85ff66a1a8adfd..644a5d24057f78 100644 --- a/Doc/glossary.rst +++ b/Doc/glossary.rst @@ -333,7 +333,7 @@ Glossary "He said his name is 'Fred'." See also the documentation for :ref:`f-strings `, and :pep:`498`, - the proposal that them. + the proposal that added them. file object An object exposing a file-oriented API (with methods such as From d38046ff30517d03c0a78d1abc5812285aa57641 Mon Sep 17 00:00:00 2001 From: Mariatta Wijaya Date: Thu, 30 Mar 2017 10:23:31 -0700 Subject: [PATCH 5/6] bpo-29928: Simplify f-strings terminology. --- Doc/glossary.rst | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/Doc/glossary.rst b/Doc/glossary.rst index 644a5d24057f78..18f51a0c19c6d8 100644 --- a/Doc/glossary.rst +++ b/Doc/glossary.rst @@ -321,19 +321,9 @@ Glossary core and with user code. f-string - Short for :dfn:`formatted string literal`, which is a string literal - that is prefixed with ``'f'`` or ``'F'``. F-strings contain - replacement fields, which are expressions delimited by curly braces - ``{}``. For example:: - - >>> name = "Fred" - >>> f"He said his name is {name!r}." - "He said his name is 'Fred'." - >>> f"He said his name is {repr(name)}." - "He said his name is 'Fred'." - - See also the documentation for :ref:`f-strings `, and :pep:`498`, - the proposal that added them. + String literals prefixed with f or F are commonly called "f-strings" + which is short for :dfn:`formatted string literal`. See also + :ref:`f-strings ` and :pep:`498`. file object An object exposing a file-oriented API (with methods such as From b55a317d8eba3e1807b18173238290e651cc6bec Mon Sep 17 00:00:00 2001 From: Mariatta Wijaya Date: Thu, 30 Mar 2017 11:03:39 -0700 Subject: [PATCH 6/6] improve wording about f-strings --- Doc/glossary.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/glossary.rst b/Doc/glossary.rst index 18f51a0c19c6d8..81238414efe49d 100644 --- a/Doc/glossary.rst +++ b/Doc/glossary.rst @@ -321,9 +321,9 @@ Glossary core and with user code. f-string - String literals prefixed with f or F are commonly called "f-strings" - which is short for :dfn:`formatted string literal`. See also - :ref:`f-strings ` and :pep:`498`. + String literals prefixed with ``'f'`` or ``'F'`` are commonly called + "f-strings" which is short for + :ref:`formatted string literals `. See also :pep:`498`. file object An object exposing a file-oriented API (with methods such as