File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -258,13 +258,14 @@ Types
258258 .. attribute :: expression
259259 :type: str
260260
261- The text of a valid Python expression, or an empty string.
262-
263- The :attr: `.expression ` is the original text of the
264- interpolation's Python expression, if the interpolation was created
265- from a t-string literal. Developers creating interpolations manually
266- should either set this to an empty string or choose a suitable valid
267- Python expression.
261+ For interpolations created from t-string literals, :attr: `!expression `
262+ is the source text found inside the curly braces, including any
263+ whitespace, but excluding the curly braces themselves. For manually
264+ created interpolations, :attr: `!expression ` is an arbitrary string.
265+
266+ It is recommended that developers manually creating
267+ :class: `!Interpolation ` instances use valid Python expressions or leave
268+ the string empty, but this is not enforced.
268269
269270 >>> t' {1 + 2}' .interpolations[0 ].expression
270271 '1 + 2'
You can’t perform that action at this time.
0 commit comments