On Sun, 18 Oct 2026 12:11:06 +0200, John Bokma wrote:
> On 18/10/2026 03:54, rbowman wrote:
>> On Sat, 17 Oct 2026 20:42:04 -0000 (UTC), Lawrence D’Oliveiro wrote:
>>
>>> Who says you need to “declare dictionaries”?
>>>
>>> l…@hypatia:~> python3 Python 3.14.7 (main, Sep 13 2026,
>>> 08:30:29)
>>> [GCC 16.2.0] on linux Type "help", "copyright", "credits" or
>>> "license"
>>> for more information.
>>> >>> a = "some text" print(a)
>>> some text
>>> >>> a = {"colour" : "green"}
>>> >>> print(a)
>>> {'colour': 'green'}
>>
>> 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.
>>>>> a = {"coluor" : "green"}
>>>>> print(a)
>> {'coluor': 'green'}
>>>>> a["color"] = "purple" print(a)
>> {'coluor': 'green', 'color': 'purple'}
>>
>>
>> I've seen bugs introduced either by typos or a programmer who couldn't
>> spell. It's either a very handy feature or a potential problem to add
>> ad hoc fields.
>
> If that's the case use a dataclass with frozen=True (and perhaps
> kw_only=True).
Yes, the language has been improving but iirc dataclass appeared in 3.7.