Python 3.11.2 (main, Apr 28 2025, 14:11:48) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import array
>>> array.array('w')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: bad typecode (must be b, B, u, h, H, i, I, l, L, q, Q, f or d)
Documentation
The
wtypecode was added in Python 3.13, but the docs do not mention it.Furthermore, the documentation on
urecommends usingwas an alternative in a note that applies to Python 3.3+, which gives the impression thatwhas been available at least since Python 3.3. This is misleading.Linked PRs
array.arraytypecodewis new in 3.13 #137184array.arraytypecodewis new in 3.13 (GH-137184) #137208array.arraytypecodewis new in 3.13 (GH-137184) #137209