Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[3.14] gh-123299: Some copyedits to What's New in 3.14 (GH-133622)#133771

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
hugovk merged 1 commit intopython:3.14frommiss-islington:backport-de28651-3.14
May 9, 2025
Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 27 additions & 5 deletionsDoc/whatsnew/3.14.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -153,10 +153,10 @@ As another example, generating HTML attributes from data:
.. code-block:: python

attributes = {"src": "shrubbery.jpg", "alt": "looks nice"}
template = t"<img {attributes} />"
assert html(template) == '<img src="shrubbery.jpg" alt="looks nice" class="looks-nice" />'
template = t"<img {attributes}>"
assert html(template) == '<img src="shrubbery.jpg" alt="looks nice" class="looks-nice">'

Unlike f-strings, the ``html`` function has access to template attributes
Compared to using an f-string, the ``html`` function has access to template attributes
containing the original information: static strings, interpolations, and values
from the original scope. Unlike existing templating approaches, t-strings build
from the well-known f-string syntax and rules. Template systems thus benefit
Expand DownExpand Up@@ -443,6 +443,9 @@ Python without deferred evaluation of annotations, reaches its end of life in 20
In Python 3.14, the behavior of code using ``from __future__ import annotations``
is unchanged.

.. seealso::
:pep:`649`.


Improved error messages
-----------------------
Expand DownExpand Up@@ -584,8 +587,27 @@ Improved error messages
^^^^^^
SyntaxError: cannot use subscript as import target

.. seealso::
:pep:`649`.
* Improved error message when trying to add an instance of an unhashable type to
a :class:`dict` or :class:`set`. (Contributed by CF Bolz-Tereick and Victor Stinner
in :gh:`132828`.)

.. code-block:: pycon

>>> s = set()
>>> s.add({'pages': 12, 'grade': 'A'})
Traceback (most recent call last):
File "<python-input-1>", line 1, in <module>
s.add({'pages': 12, 'grade': 'A'})
~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: cannot use 'dict' as a set element (unhashable type: 'dict')
>>> d = {}
>>> l = [1, 2, 3]
>>> d[l] = 12
Traceback (most recent call last):
File "<python-input-4>", line 1, in <module>
d[l] = 12
~^^^
TypeError: cannot use 'list' as a dict key (unhashable type: 'list')


.. _whatsnew314-pep741:
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp