🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.python
Article #67

Re: Back To CS Basics. Fuck AI

#67
From: John Bokma
Date: Sun, 18 Oct 2026 10:38
63 lines
3902 bytes
On 18/10/2026 12:11, 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”?
>>>
>>>      ldo@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).

❯ python3
Python 3.14.7 (main, Aug  8 2026, 20:03:42) [Clang 13.1.6 
(clang-1316.0.21.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
 >>> from dataclasses import dataclass
 >>> @dataclass(frozen=True, kw_only=True)
... class Config:
...     color: str
...
 >>> a = Config(color='purple')
 >>> a.coluor
Traceback (most recent call last):
   File "<python-input-3>", line 1, in <module>
     a.coluor
AttributeError: 'Config' object has no attribute 'coluor'. Did you mean: 
'color'?
 >>> a.color = 'green'
Traceback (most recent call last):
   File "<python-input-4>", line 1, in <module>
     a.color = 'green'
     ^^^^^^^
   File "<string>", line 15, in __setattr__
dataclasses.FrozenInstanceError: cannot assign to field 'color'
 >>> a.color
'purple'
 >>>

-- 
Static tumblelog generator: https://github.com/john-bokma/tumblelog/
Available as Python or Perl. Example tumblelog: https://plurrrr.com/
Technical Details
Message-ID: <11b27jb$121rl$1@dont-email.me>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <18dee4b6cab427fa$865$2574533$802601b3@news.usenetexpress.com> <11atgth$3e59h$1@dont-email.me> <18df0ea174d534e0$1613$2650862$802601b3@news.usenetexpress.com> <11atlpr$3g55c$1@dont-email.me> <11au66n$3m5co$6@dont-email.me> <11aucit$3o8ih$3@dont-email.me> <6ad34325$0$3147$426a74cc@news.free.fr> <wwv33u4o26s.fsf@LkoBDZeT.terraraq.uk> <6ad3a65d$0$31896$426a74cc@news.free.fr> <11b0mis$iems$7@dont-email.me> <njin6fFei39U19@mid.individual.net> <11b25vq$11csg$1@dont-email.me>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: John Bokma <contact@johnbokma.com>
Newsgroups: comp.os.linux.misc,comp.lang.python
Subject: Re: Back To CS Basics. Fuck AI
Date: Sun, 18 Oct 2026 12:38:33 +0200
Organization: A noiseless patient Spider
Lines: 63
Message-ID: <11b27jb$121rl$1@dont-email.me>
References: <18dee4b6cab427fa$865$2574533$802601b3@news.usenetexpress.com>
 <11atgth$3e59h$1@dont-email.me>
 <18df0ea174d534e0$1613$2650862$802601b3@news.usenetexpress.com>
 <11atlpr$3g55c$1@dont-email.me> <11au66n$3m5co$6@dont-email.me>
 <11aucit$3o8ih$3@dont-email.me> <6ad34325$0$3147$426a74cc@news.free.fr>
 <wwv33u4o26s.fsf@LkoBDZeT.terraraq.uk>
 <6ad3a65d$0$31896$426a74cc@news.free.fr> <11b0mis$iems$7@dont-email.me>
 <njin6fFei39U19@mid.individual.net> <11b25vq$11csg$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 18 Oct 2026 10:38:36 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="1116021"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+bgQwx2hUj/6pLDRcuwyJ5MvNDhp8E+jg="; posting-host="a7811059ec1df9ebdcae1c8192555339"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:kTyJFWt2XK0lm/0IQyesKqALUNE= sha256:TUiiiZykWOgCUEb1qvhInjP3NtuQRD16QiyWVVRdAfo=
	sha1:cdMRuF/K0A18z5PJ2lVkDiXzQqw= sha256:XldIdCQcq6x3ZKWKEwlZTJVJlqdQXZ/0HorwNsVI96A=
Content-Language: en-US
In-Reply-To: <11b25vq$11csg$1@dont-email.me>