🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.lang.python
14 messages
14 total messages Started by Lawrence D’Oliveiro Sat, 17 Oct 2026 20:42
Re: Back To CS Basics. Fuck AI
#56
Author: Lawrence D’Oliveiro
Date: Sat, 17 Oct 2026 20:42
27 lines
2571 bytes
On 17 Oct 2026 16:46:21 GMT, Stéphane CARPENTIER wrote:

> In this case python is a strongly typed language and in other cases
> it's not that important.

It’s *always* important. Consider why languages like PHP (ptui) and
JavaScript need that extra “===” comparison operator: it’s to disable
automatic type conversions (e.g. number ↔ string) that Python refuses
to do anyway.

> With some typed languages, you can't use a variable if you didn't
> declare it's type before. With python, you don't need to declare
> integers and strings but you need to declare dictionaries. Why? Don't
> know.

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'}
    >>>
Re: Back To CS Basics. Fuck AI
#62
Author: rbowman
Date: Sun, 18 Oct 2026 01:54
27 lines
2135 bytes
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.
Re: Back To CS Basics. Fuck AI
#65
Author: John Bokma
Date: Sun, 18 Oct 2026 10:11
35 lines
2938 bytes
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).

-- 
Static tumblelog generator: https://github.com/john-bokma/tumblelog/
Available as Python or Perl. Example tumblelog: https://plurrrr.com/
Re: Back To CS Basics. Fuck AI
#67
Author: 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/
Re: Back To CS Basics. Fuck AI
#69
Author: rbowman
Date: Sun, 18 Oct 2026 20:01
36 lines
2530 bytes
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”?
>>>
>>>      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).

Yes, the language has been improving but iirc dataclass appeared in 3.7.
Re: Back To CS Basics. Fuck AI
#71
Author: John Bokma
Date: Sun, 18 Oct 2026 20:25
17 lines
2274 bytes
On 18/10/2026 22:01, rbowman wrote:
> On Sun, 18 Oct 2026 12:11:06 +0200, John Bokma wrote:

[snip]

>> 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.

named tuples are another, older way.

But 3.7, that's 2018!

-- 
Static tumblelog generator: https://github.com/john-bokma/tumblelog/
Available as Python or Perl. Example tumblelog: https://plurrrr.com/
Re: Back To CS Basics. Fuck AI
#82
Author: rbowman
Date: Mon, 19 Oct 2026 03:19
34 lines
2579 bytes
On Sun, 18 Oct 2026 22:25:06 +0200, John Bokma wrote:

> On 18/10/2026 22:01, rbowman wrote:
>> On Sun, 18 Oct 2026 12:11:06 +0200, John Bokma wrote:
> 
> [snip]
> 
>>> 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.
> 
> named tuples are another, older way.
> 
> But 3.7, that's 2018!

That brings up an interesting question. How many people who have been 
using Python for a decade or two keep up with the latest changes? What 
they have been doing still works and they don't go out of their way to 
read PEP 666 or whatever. 

I'm certainly guilty. I pick and choose what I find useful  f strings are 
the greatest things since sliced bread. I suppose I might have to deal 
with asyncio someday but I'll cross that bridge when I come to it. I 
learned to hate await in C#.

It's not only Python. Whatever C spec that allowed inline variable 
declarations was great. I'd gotten used to it in C++. I'm sure there were 
other changes that I don't use. Some I actively dislike. afaik C still 
doesn't have lambdas. 

As far as Fortran, I'm stuck at f77.  It still works.
Re: Back To CS Basics. Fuck AI
#86
Author: Keith Thompson
Date: Mon, 19 Oct 2026 04:48
19 lines
2531 bytes
rbowman <bowman@montana.com> writes:
[...]
> It's not only Python. Whatever C spec that allowed inline variable 
> declarations was great. I'd gotten used to it in C++. I'm sure there were 
> other changes that I don't use. Some I actively dislike. afaik C still 
> doesn't have lambdas. 
[...]

I *think* you're referring to the ability to mix declarations and
statements within a block.  This was added in the 1999 edition of
the C standard.  C++ had this ability nearly from the beginning (I
don't know the exact history).

C++ has another feature of inline variables, using the "inline"
keyword, added in C++17.

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */
Re: Back To CS Basics. Fuck AI
#90
Author: John Bokma
Date: Mon, 19 Oct 2026 09:29
17 lines
2465 bytes
On 19/10/2026 05:19, rbowman wrote:
> On Sun, 18 Oct 2026 22:25:06 +0200, John Bokma wrote:

[..]

>> But 3.7, that's 2018!
> 
> That brings up an interesting question. How many people who have been
> using Python for a decade or two keep up with the latest changes? What
> they have been doing still works and they don't go out of their way to
> read PEP 666 or whatever.

I do. I like to read "What's new in Python 3.x". I do the same with Perl

-- 
Static tumblelog generator: https://github.com/john-bokma/tumblelog/
Available as Python or Perl. Example tumblelog: https://plurrrr.com/
Re: Back To CS Basics. Fuck AI
#93
Author: Richard Kettlewell
Date: Mon, 19 Oct 2026 16:29
18 lines
2493 bytes
John Bokma <contact@johnbokma.com> writes:
> On 19/10/2026 05:19, rbowman wrote:
>> On Sun, 18 Oct 2026 22:25:06 +0200, John Bokma wrote:
>>> But 3.7, that's 2018!
>> That brings up an interesting question. How many people who have been
>> using Python for a decade or two keep up with the latest changes?
>> What they have been doing still works and they don't go out of their
>> way to read PEP 666 or whatever.
>
> I do. I like to read "What's new in Python 3.x". I do the same with Perl

Currently my most prolific source of updates to my Python knowledge is
code reviews with someone who keeps up with the changes a bit better
than I do, which has the advantage that new features come to me with an
immediately useful context attached.

-- 
https://www.greenend.org.uk/rjk/
Re: Back To CS Basics. Fuck AI
#92
Author: The Natural Philosopher
Date: Mon, 19 Oct 2026 16:34
15 lines
2473 bytes
On 19/10/2026 17:29, Richard Kettlewell wrote:
> which has the advantage that new features come to me with an
> immediately useful context attached.

Radical!

-- 
“People believe certain stories because everyone important tells them, 
and people tell those stories because everyone important believes them. 
Indeed, when a conventional wisdom is at its fullest strength, one’s 
agreement with that conventional wisdom becomes almost a litmus test of 
one’s suitability to be taken seriously.”

Paul Krugman
Re: Back To CS Basics. Fuck AI
#95
Author: John Bokma
Date: Mon, 19 Oct 2026 16:51
22 lines
2922 bytes
On 19/10/2026 18:29, Richard Kettlewell wrote:
> John Bokma <contact@johnbokma.com> writes:
>> On 19/10/2026 05:19, rbowman wrote:
>>> On Sun, 18 Oct 2026 22:25:06 +0200, John Bokma wrote:
>>>> But 3.7, that's 2018!
>>> That brings up an interesting question. How many people who have been
>>> using Python for a decade or two keep up with the latest changes?
>>> What they have been doing still works and they don't go out of their
>>> way to read PEP 666 or whatever.
>>
>> I do. I like to read "What's new in Python 3.x". I do the same with Perl
> 
> Currently my most prolific source of updates to my Python knowledge is
> code reviews with someone who keeps up with the changes a bit better
> than I do, which has the advantage that new features come to me with an
> immediately useful context attached.

That's nice.

-- 
Static tumblelog generator: https://github.com/john-bokma/tumblelog/
Available as Python or Perl. Example tumblelog: https://plurrrr.com/
Re: Back To CS Basics. Fuck AI
#97
Author: rbowman
Date: Mon, 19 Oct 2026 19:57
22 lines
2088 bytes
On Mon, 19 Oct 2026 11:29:04 +0200, John Bokma wrote:

> On 19/10/2026 05:19, rbowman wrote:
>> On Sun, 18 Oct 2026 22:25:06 +0200, John Bokma wrote:
> 
> [..]
> 
>>> But 3.7, that's 2018!
>> 
>> That brings up an interesting question. How many people who have been
>> using Python for a decade or two keep up with the latest changes? What
>> they have been doing still works and they don't go out of their way to
>> read PEP 666 or whatever.
> 
> I do. I like to read "What's new in Python 3.x". I do the same with Perl

https://gitlab.com/flufl/whatsnewt

"A TUI text adventure through what's new in Python 3.15."

Interesting approach. 
Re: Back To CS Basics. Fuck AI
#98
Author: John Bokma
Date: Mon, 19 Oct 2026 20:24
28 lines
2833 bytes
On 19/10/2026 21:57, rbowman wrote:
> On Mon, 19 Oct 2026 11:29:04 +0200, John Bokma wrote:
> 
>> On 19/10/2026 05:19, rbowman wrote:
>>> On Sun, 18 Oct 2026 22:25:06 +0200, John Bokma wrote:
>>
>> [..]
>>
>>>> But 3.7, that's 2018!
>>>
>>> That brings up an interesting question. How many people who have been
>>> using Python for a decade or two keep up with the latest changes? What
>>> they have been doing still works and they don't go out of their way to
>>> read PEP 666 or whatever.
>>
>> I do. I like to read "What's new in Python 3.x". I do the same with Perl
> 
> https://gitlab.com/flufl/whatsnewt
> 
> "A TUI text adventure through what's new in Python 3.15."
> 
> Interesting approach.

Thanks! Will check it out later.

-- 
Static tumblelog generator: https://github.com/john-bokma/tumblelog/
Available as Python or Perl. Example tumblelog: https://plurrrr.com/
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads