While building examples for a talk I’ll give about “new stuff in py 3.14 and 3.15”, I found that the Python 3.14 that comes with the system (Ubuntu 26.04.1) and Python3.15 that I installed through Deadsnakes PPA don’t show spelling suggestions:
>>> [].apend(3)
...
AttributeError: 'list' object has no attribute 'apend'
However both an old Python3.10 and a compiled from main 3.16 do:
>>> [].apend(3)
...
AttributeError: 'list' object has no attribute 'apend'. Did you mean: 'append'?
For the more recent improvement it’s similar, not showing the suggestion in my 3.14 and 3.15:
>>> whille True:
...
SyntaxError: invalid syntax
But it’s there in 3.16:
>>> whille True:
...
SyntaxError: invalid syntax. Did you mean 'while'?
Do we have those builds broken somehow? There’s something else to be installed in my system? Something weirder is going on? Thanks!
I do get the expected spelling suggestions with Python 3.15 on macOS, installed with the official installer:
Python 3.15.2 (v3.15.2:5e58eaad7c5, Oct 25 2026, 14:19:34) [Clang 21.0.0 (clang-2100.1.1.101)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> [].apend(3)
Traceback (most recent call last):
File "<python-input-0>", line 1, in <module>
[].apend(3)
^^^^^^^^
AttributeError: 'list' object has no attribute 'apend'. Did you mean '.append' instead of '.apend'?
>>> whille True:
File "<python-input-1>", line 1
whille True:
^^^^^^
SyntaxError: invalid syntax. Did you mean 'while'?
Ah, it’s a good idea to show exactly the build. So, for example:
$ python3.14
Python 3.14.4 (main, Aug 20 2026, 10:41:58) [GCC 15.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> [].apend(3)
Traceback (most recent call last):
File "<python-input-0>", line 1, in <module>
[].apend(3)
^^^^^^^^
AttributeError: 'list' object has no attribute 'apend'
>>>
$ python3.15
Python 3.15.2 (main, Oct 26 2026, 15:27:56) [GCC 15.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> whille True:
File "<python-input-0>", line 1
whille True:
^
SyntaxError: invalid syntax
>>>
Python 3.14.4 (main, Aug 20 2026, 10:41:58) [GCC 15.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> [].apend(3)
Traceback (most recent call last):
File "<python-input-0>", line 1, in <module>
[].apend(3)
^^^^^^^^
AttributeError: 'list' object has no attribute 'apend'. Did you mean: 'append'?
>>> whille True:
File "<python-input-1>", line 1
whille True:
^^^^^^
SyntaxError: invalid syntax. Did you mean 'while'?
Also get them after adding 3.15 via deadsnakes to the same container:
Python 3.15.2 (main, Oct 26 2026, 15:27:56) [GCC 15.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> [].apend(3)
Traceback (most recent call last):
File "<python-input-0>", line 1, in <module>
[].apend(3)
^^^^^^^^
AttributeError: 'list' object has no attribute 'apend'. Did you mean '.append' instead of '.apend'?
>>> whille True:
File "<python-input-1>", line 1
whille True:
^^^^^^
SyntaxError: invalid syntax. Did you mean 'while'?
Seems like something in your system? Does running Python with -I (“isolate Python from the user’s environment (implies -E, -P and -s)”) make a difference?
Exception hints are not part of the exception object raised during parsing and execution. They are (optionally) added as part of formatting a traceback. By default, exceptions are handled by function sys.excepthook, which by default is builtin function excepthook, which adds version-dependent hints. Distributions and applications can replace sys.excepthook. You can check the value of sys.excepthook. Custom handlers can access the hint machinery via traceback.format_exception_only. IDLE recently made a switch very similar to the below difference to get hints added.
>>> try:
... [].apend(1)
... except AttributeError as e:
... print(f"{e.__class__.__name__}: {str(e)}")
# prints> AttributeError: 'list' object has no attribute 'apend'
>>> try:
... [].apend(1)
... except AttributeError as e:
... print(t.format_exception_only(e)[0])
# prints> AttributeError: 'list' object has no attribute 'apend'. Did you mean '.append' instead of '.apend'?
I have no idea whether any of this is relevant to Ubuntu and DeadSnakes, but it might be for your talk.
Ubuntu has an error reporting tool called Apport that installs a Python excepthook. Apport might not be installed by default in Ubuntu containers, but it will be on actual full desktop systems.
Here’s what I get on Ubuntu 26.04:
$ python
Python 3.14.4 (main, Aug 20 2026, 10:41:58) [GCC 15.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.excepthook
<function install.<locals>.partial_apport_excepthook at 0x714590ba3ed0>
>>> whillle Trye: pass
File "<python-input-2>", line 1
whillle Trye: pass
^^^^^^^
SyntaxError: invalid syntax. Did you mean 'while'?
>>> [].apend(3)
Traceback (most recent call last):
File "<python-input-0>", line 1, in <module>
[].apend(3)
^^^^^^^^
AttributeError: 'list' object has no attribute 'apend'. Did you mean: 'append'?
so the apport-installed excepthook does not break this functionality for me and you need to look for a different reason for the breakage.