Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

All great discoveries are made by mistake. -- Young


devel / comp.lang.python / RE: Newline (NuBe Question)

SubjectAuthor
* RE: Newline (NuBe Question)<avi.e.gross
`* Re: RE: Newline (NuBe Question)Michael F. Stemper
 +- Re: RE: Newline (NuBe Question)Chris Angelico
 +- Re: Newline (NuBe Question)Roel Schroeven
 +- RE: RE: Newline (NuBe Question)<avi.e.gross
 +- RE: RE: Newline (NuBe Question)<avi.e.gross
 +- Re: Newline (NuBe Question)Peter J. Holzer
 +- Re: Newline (NuBe Question)DL Neil
 +- Re: RE: Newline (NuBe Question)Chris Angelico
 +- Re: Newline (NuBe Question)DL Neil
 +- Re: Newline (NuBe Question)DL Neil
 +- RE: Newline (NuBe Question)<avi.e.gross
 +- Re: Newline (NuBe Question)Chris Angelico
 +- RE: Newline (NuBe Question)<avi.e.gross
 +- Re: Newline (NuBe Question)'DL Neil'
 `- RE: Newline (NuBe Question)<avi.e.gross

1
RE: Newline (NuBe Question)

<mailman.289.1700883959.3828.python-list@python.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=28940&group=comp.lang.python#28940

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!paganini.bofh.team!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: <avi.e.gross@gmail.com>
Newsgroups: comp.lang.python
Subject: RE: Newline (NuBe Question)
Date: Fri, 24 Nov 2023 22:45:54 -0500
Lines: 61
Message-ID: <mailman.289.1700883959.3828.python-list@python.org>
References: <65547270.3139.338043@RealGrizzlyAdams.vivaldi.net>,
<6555B48F.10108.156EC1@RealGrizzlyAdams.vivaldi.net>,
<4626640f-4fe5-49bc-a6f8-d555b7f7b58a@tompassin.net>
<65561BDA.14413.9EACE9@RealGrizzlyAdams.vivaldi.net>
<016601da1f51$e4e84410$aeb8cc30$@gmail.com>
Mime-Version: 1.0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de iwAUEZmIMt+kUXQ2fRTYSAaseK19bs//e36LxQGD17fw==
Cancel-Lock: sha1:N/cUdiJtBCAy2j8cfUYcp8F70eE= sha256:uj6JfsnqYA4k4lXKKQnxPPp7+Dq/kac67+s/FzEpNwE=
Return-Path: <avi.e.gross@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=WOffQxPp;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.030
X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'containing': 0.05; '2023':
0.07; 'modules': 0.07; 'matrix': 0.09; 'output:': 0.09;
'received:108': 0.09; 'smaller': 0.09; 'url:mailman': 0.15;
'memory': 0.15; 'lesson,': 0.16; 'newline': 0.16; 'once.': 0.16;
'part)': 0.16; 'received:mail-qt1-x82b.google.com': 0.16;
'sorted': 0.16; 'structures': 0.16; 'subject:Newline': 0.16;
'vague': 0.16; 'wrote:': 0.16; 'message-id:@gmail.com': 0.18;
'16,': 0.19; 'subject:Question': 0.19; 'to:addr:python-list':
0.20; 'list,': 0.24; 'student': 0.24; 'skip:- 10': 0.25; 'url-
ip:188.166.95.178/32': 0.25; 'url-ip:188.166.95/24': 0.25;
'examples': 0.25; 'url:listinfo': 0.25; 'url-ip:188.166/16': 0.25;
'bit': 0.27; '>>>': 0.28; 'printed': 0.28; 'suggest': 0.28; 'url-
ip:188/8': 0.31; 'program': 0.31; 'think': 0.32; 'maintaining':
0.32; 'python-list': 0.32; 'structure': 0.32; 'but': 0.32;
'there': 0.33; 'printing': 0.34; 'header:In-Reply-To:1': 0.34;
'received:google.com': 0.34; 'item': 0.35; 'yes,': 0.35;
'from:addr:gmail.com': 0.35; 'work,': 0.36; 'change': 0.36;
'lists': 0.37; 'using': 0.37; 'students': 0.38; 'could': 0.38;
'least': 0.39; 'list': 0.39; 'use': 0.39; 'seeing': 0.39; 'wrote':
0.39; 'serious': 0.40; 'something': 0.40; 'should': 0.40; 'here.':
0.61; 'above': 0.62; 'from:': 0.62; 'to:': 0.62; 're:': 0.64;
'your': 0.64; 'let': 0.66; 'order': 0.69; 'and,': 0.69;
'responding': 0.69; 'knowing': 0.71; 'little': 0.73; 'choice':
0.76; 'sent:': 0.78; 'left': 0.83; 'reasons': 0.84; 'cum': 0.84;
'selects': 0.84; 'adams': 0.91; 'avoiding': 0.91; 'mixed': 0.93
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1700883956; x=1701488756; darn=python.org;
h=content-language:thread-index:content-transfer-encoding
:mime-version:message-id:date:subject:in-reply-to:references:to:from
:from:to:cc:subject:date:message-id:reply-to;
bh=+93eq3pU9qO2xCn0RMHCekyiSsv1nXktjVVIQvfao9g=;
b=WOffQxPp2jrsVyejGcRIT3HvLjIxSdGjYeJFCYqfdh0aQFMRt+axwcSYFJQHQxu8GP
5CXdg3QU+2UIWKcGytsmIiVSwI94ZXKJ0utcBHJBRgaGvxuwT7oIctsFzpUYFH09D+uc
BMcooQsL8A/3GosojErDIqhsbYrlPSYelBT3x6f3brwy5JVipLyiGTaJ92ZrKQqkI2X1
FcmY+9GsYRkqiKQW84Q5CEjHbjJ3SKAeqINNjmnfsqdnnnQV2c61LKcFYE4Nb68ocV8d
lyn6959D+KDWm4m/Oi/JhdYYNbyJaedXe5SIWrBsMMnlorh0wl1UevXqYUeSwvTjjI9u
ry3Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1700883956; x=1701488756;
h=content-language:thread-index:content-transfer-encoding
:mime-version:message-id:date:subject:in-reply-to:references:to:from
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=+93eq3pU9qO2xCn0RMHCekyiSsv1nXktjVVIQvfao9g=;
b=PV0WGYbeBQM4hPm6yxQZvsRMXHZyMC250Zj4gn/8MpOFVwJ+FxseuKORUsYJv8pAuX
B5NG+nq5n6mXsrj/yJfGQlZppGfFNlbCohG50ZOykIUw6KrvECOmjzw5IciQQnJTu/sh
gn/Mc/7EHtm4TkEq+MnCY2wB+T8sWahtHgbtNp7vZ3gM8tC481yBPF4e5HdlT8y2iofa
Nc4IX4Wp6bneYj7k07TtAtlg0QYazT0fol4duaFNFnzL+UC2meOGC/xibvj+wORrE+gB
zILtc3CYr/iO6YyevF59EVwjq2btADMf9NLN+WjBtn9OBY6ZlBG2FEK9KxfxYqo5/VRa
WxlA==
X-Gm-Message-State: AOJu0YyjqBN7Pl419/a6eSFgBZS2+juJ2o59U0YZGlmYCp5FS/ZTJnf/
0e7csEHkphJrGb6G1WabIXl3Bf2LleQ=
X-Google-Smtp-Source: AGHT+IEwTIGz/Zf7m2DkPsE0VgSYsuEkNIDzyaPbScp71cab+2Ch2Te0Dz4YgIkbUpKEtNrDUaUSvA==
X-Received: by 2002:a05:622a:2:b0:423:75bb:f78b with SMTP id
x2-20020a05622a000200b0042375bbf78bmr5818981qtw.46.1700883956307;
Fri, 24 Nov 2023 19:45:56 -0800 (PST)
In-Reply-To: <65561BDA.14413.9EACE9@RealGrizzlyAdams.vivaldi.net>
X-Mailer: Microsoft Outlook 16.0
Thread-Index: AQLE5XCijAbYn+n7sN9UKc2YtIQx7wCvRdtIAgiVzWYCiv+1DK6Kuviw
Content-Language: en-us
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <016601da1f51$e4e84410$aeb8cc30$@gmail.com>
X-Mailman-Original-References: <65547270.3139.338043@RealGrizzlyAdams.vivaldi.net>,
<6555B48F.10108.156EC1@RealGrizzlyAdams.vivaldi.net>,
<4626640f-4fe5-49bc-a6f8-d555b7f7b58a@tompassin.net>
<65561BDA.14413.9EACE9@RealGrizzlyAdams.vivaldi.net>
 by: <avi.e.gross@gmail.com> - Sat, 25 Nov 2023 03:45 UTC

Grizz[l]y,

I think the point is not about a sorted list or sorting in general It is
about reasons why maintaining a data structure such as a list in a program
can be useful beyond printing things once. There are many possible examples
such as having a list of lists containing a record where the third item is a
GPA for the student and writing a little list comprehension that selects a
smaller list containing only students who are Magna Cum Laude or Summa Cum
Laude.

studs = [
["Peter", 82, 3.53],
["Paul", 77, 2.83],
["Mary", 103, 3.82]
]
magna = [stud for stud in studs if stud[2] >= 3.5 ]
summa = [stud for stud in studs if stud[2] >= 3.75 ]

print(studs, magna, summa, sep="\n")

OUTPUT:

>>> print(studs, magna, summa, sep="\n")
[['Peter', 82, 3.53], ['Paul', 77, 2.83], ['Mary', 103, 3.82]]
[['Peter', 82, 3.53], ['Mary', 103, 3.82]]
[['Mary', 103, 3.82]]

Of course, for serious work, some might suggest avoiding constructs like a
list of lists and switch to using modules and data structures that are often
more efficient to represent your data such as some form of matrix or
data.frame.

And, yes, you can sort something like the above by name or GPA or number of
credits taken but the point was responding to why bother making a list just
to print it. The answer is that many and even most programs do a bit more
than that and a good choice of data structure facilitates ...

-----Original Message-----
From: Python-list <python-list-bounces+avi.e.gross=gmail.com@python.org> On
Behalf Of Grizzy Adams via Python-list
Sent: Thursday, November 16, 2023 8:41 AM
To: python-list@python.org
Subject: Re: Newline (NuBe Question)

Thursday, November 16, 2023 at 7:47, Thomas Passin via Python-list wrote:
Re: Newline (NuBe Question) (at least in part)

>I wrote that you don't need the "students" list, which is correct. But
>there could be a use for a list. It would let you change the order in
>which students appear in the printed output. Knowing how to do that is
>a useful skill. But that should be left for a later lesson, not mixed
>in here.

I have a vague memory of seeing sorted list somewhere ;->)
--
https://mail.python.org/mailman/listinfo/python-list

Re: RE: Newline (NuBe Question)

<ujt0i2$2r3tf$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=28943&group=comp.lang.python#28943

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.bbs.nz!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: michael.stemper@gmail.com (Michael F. Stemper)
Newsgroups: comp.lang.python
Subject: Re: RE: Newline (NuBe Question)
Date: Sat, 25 Nov 2023 08:32:24 -0600
Organization: A noiseless patient Spider
Lines: 42
Message-ID: <ujt0i2$2r3tf$1@dont-email.me>
References: <65547270.3139.338043@RealGrizzlyAdams.vivaldi.net>
<6555B48F.10108.156EC1@RealGrizzlyAdams.vivaldi.net>
<4626640f-4fe5-49bc-a6f8-d555b7f7b58a@tompassin.net>
<65561BDA.14413.9EACE9@RealGrizzlyAdams.vivaldi.net>
<016601da1f51$e4e84410$aeb8cc30$@gmail.com>
<mailman.289.1700883959.3828.python-list@python.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 25 Nov 2023 14:32:34 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="96c2e28d2dabfed3c34683da5437f02c";
logging-data="2985903"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/ApXiQXLQ89vxvyPmEYkvsKh9iSZAM1aw="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.11.0
Cancel-Lock: sha1:2vlUKoThHTnD2OUrrCusZ/fobEg=
In-Reply-To: <mailman.289.1700883959.3828.python-list@python.org>
Content-Language: en-US
 by: Michael F. Stemper - Sat, 25 Nov 2023 14:32 UTC

On 24/11/2023 21.45, avi.e.gross@gmail.com wrote:
> Grizz[l]y,
>
> I think the point is not about a sorted list or sorting in general It is
> about reasons why maintaining a data structure such as a list in a program
> can be useful beyond printing things once. There are many possible examples
> such as having a list of lists containing a record where the third item is a
> GPA for the student and writing a little list comprehension that selects a
> smaller list containing only students who are Magna Cum Laude or Summa Cum
> Laude.
>
> studs = [
> ["Peter", 82, 3.53],
> ["Paul", 77, 2.83],
> ["Mary", 103, 3.82]
> ]

I've seen Mary, and she didn't look like a "stud" to me.

> Of course, for serious work, some might suggest avoiding constructs like a
> list of lists and switch to using modules and data structures [...]

Those who would recommend that approach do not appear to include Mr.
Rossum, who said:

Avoid overengineering data structures. Tuples are better than
objects (try namedtuple too though). Prefer simple fields over
getter/setter functions... Built-in datatypes are your friends.
Use more numbers, strings, tuples, lists, sets, dicts. Also
check out the collections library, eps. deque.[1]

I was nodding along with the people saying "list of lists" until I
reread this quote. A list of tuples seems most appropriate to me.


[1] <https://gist.github.com/hemanth/3715502>, as quoted by Bill
Lubanovic in _Introducing Python_

--
Michael F. Stemper
This sentence no verb.

Re: RE: Newline (NuBe Question)

<mailman.294.1700999342.3828.python-list@python.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=28950&group=comp.lang.python#28950

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!nntp.comgw.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: rosuav@gmail.com (Chris Angelico)
Newsgroups: comp.lang.python
Subject: Re: RE: Newline (NuBe Question)
Date: Sun, 26 Nov 2023 22:48:49 +1100
Lines: 29
Message-ID: <mailman.294.1700999342.3828.python-list@python.org>
References: <65547270.3139.338043@RealGrizzlyAdams.vivaldi.net>
<6555B48F.10108.156EC1@RealGrizzlyAdams.vivaldi.net>
<4626640f-4fe5-49bc-a6f8-d555b7f7b58a@tompassin.net>
<65561BDA.14413.9EACE9@RealGrizzlyAdams.vivaldi.net>
<016601da1f51$e4e84410$aeb8cc30$@gmail.com>
<mailman.289.1700883959.3828.python-list@python.org>
<ujt0i2$2r3tf$1@dont-email.me>
<CAPTjJmo2cZjPvC8_=0vbQAyhA4t5LS-c=QCekZqmpWogxCJo6Q@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: news.uni-berlin.de 0f9mwooiYNt1vjN3kgMw2wZjFWsCiwtcAMja7liVzbLA==
Cancel-Lock: sha1:zLW+10MatCECbIm2Dy9IlW+By8E= sha256:hHLKeJUdG9dFbgHKkMix6Kf5v8GG3IZb+YCqD1+ZO4k=
Return-Path: <rosuav@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=miiVaOTF;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.037
X-Spam-Evidence: '*H*': 0.93; '*S*': 0.00; 'containing': 0.05; '2023':
0.07; 'sun,': 0.07; 'smaller': 0.09; 'chrisa': 0.16;
'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16;
'functions.': 0.16; 'mathematical': 0.16; 'once.': 0.16; 'sorted':
0.16; 'subject:Newline': 0.16; 'wrote:': 0.16; 'libraries': 0.19;
'subject:Question': 0.19; 'to:addr:python-list': 0.20; "i've":
0.22; 'student': 0.24; 'examples': 0.25; 'program': 0.31; 'think':
0.32; 'maintaining': 0.32; 'python-list': 0.32; 'structure': 0.32;
'message-id:@mail.gmail.com': 0.32; 'there': 0.33; "didn't": 0.34;
'printing': 0.34; 'header:In-Reply-To:1': 0.34;
'received:google.com': 0.34; 'item': 0.35; 'from:addr:gmail.com':
0.35; 'lists': 0.37; 'though': 0.37; 'students': 0.38; 'list':
0.39; 'michael': 0.60; "there's": 0.61; 'me.': 0.62; 'seen': 0.62;
'email addr:gmail.com': 0.63; 'she': 0.64; 'look': 0.65; 'little':
0.73; 'happens': 0.84; 'reasons': 0.84; 'cum': 0.84; 'selects':
0.84; 'received:mail-lj1-x22b.google.com': 0.91
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1700999340; x=1701604140; darn=python.org;
h=to:subject:message-id:date:from:in-reply-to:references:mime-version
:from:to:cc:subject:date:message-id:reply-to;
bh=Tpaqmz5MhMxpvzdbrlfoLmT7w2MqflRX+aJDpXWDU9c=;
b=miiVaOTFAbZQl2uHNOmINMNkHJSv5SzCjqAeovsYBr7qAuJPWqgkV3PFblxLzQJXzP
W0i6WNXi5Yb48NhwpG1FzfUUsnxc9PQRtEHp/h6SsenVQ/YijJi39nqSnjxLKPA6vyZb
h1r0IiitGUIC1U27CnNcn5L87u2TIMGE8IhIBDKlHrK1mj/ZwUZ42sVZO2x6XNz/hL3/
iDkSeOeQxUPyEm3IpRNSkE8EoFKTfIFAkd/A/st7tUko8bj9sd2OqaSkcsow/D2e3F8v
EJMrqCO8KUlxEcO5GkDZlIROSq1+EE/p3tKCvKGeddn99WpMKfhL2NIgqszbp+w2v9Yi
TWHA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1700999340; x=1701604140;
h=to:subject:message-id:date:from:in-reply-to:references:mime-version
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=Tpaqmz5MhMxpvzdbrlfoLmT7w2MqflRX+aJDpXWDU9c=;
b=lRgtISro1ZcaehHCyBARfEiJeA2ncRl/xKwgr1YPVEpiPUYEQDTO9OJ3put3ow/oNN
J6WE5WKM1ExEghEcSoo0JmmcSDnDk9nfch1QPw6M9rIUNK+moRw0iWKYwqBbdtrgWiKf
weGu9w4g0fm4QC3mQax/YQpbf4Qr79N8jeNzkRnCw6wpwv9yKos6O+hHsi39AJaKIHy0
SA6Oisqv5ZsjIA+FDfA7jTDX+oeW+n7Vp7NZgBwQZVWFECUXXZ4nnf8bZFjgLWaonlCG
7Bl7DJgQCKQI67glR+rTGn/yhWhTTYdYwJ38PeIo+Xpq817m5LEPby1tmADD37Qfv32j
duig==
X-Gm-Message-State: AOJu0Yw5adWra4nwWz7gFwpfM0UgkYtyLoK1HAkVKS2ZH8LyLhI5QCQM
B+IHzlXV0fbVnPlDk3u8ZdVKyLnvOswxzeY2HUS6Wo5S
X-Google-Smtp-Source: AGHT+IEbhOADJNq1ZImi18Hv41bCZ18u+lX8QNkwdKfE5UuiVN7EOH0s0UwUuH5le/JmgTWzJoMDnZOZc/oqA+5CLEA=
X-Received: by 2002:a2e:a692:0:b0:2c9:a08a:ba3f with SMTP id
q18-20020a2ea692000000b002c9a08aba3fmr427295lje.2.1700999340435; Sun, 26 Nov
2023 03:49:00 -0800 (PST)
In-Reply-To: <ujt0i2$2r3tf$1@dont-email.me>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <CAPTjJmo2cZjPvC8_=0vbQAyhA4t5LS-c=QCekZqmpWogxCJo6Q@mail.gmail.com>
X-Mailman-Original-References: <65547270.3139.338043@RealGrizzlyAdams.vivaldi.net>
<6555B48F.10108.156EC1@RealGrizzlyAdams.vivaldi.net>
<4626640f-4fe5-49bc-a6f8-d555b7f7b58a@tompassin.net>
<65561BDA.14413.9EACE9@RealGrizzlyAdams.vivaldi.net>
<016601da1f51$e4e84410$aeb8cc30$@gmail.com>
<mailman.289.1700883959.3828.python-list@python.org>
<ujt0i2$2r3tf$1@dont-email.me>
 by: Chris Angelico - Sun, 26 Nov 2023 11:48 UTC

On Sun, 26 Nov 2023 at 21:08, Michael F. Stemper via Python-list
<python-list@python.org> wrote:
>
> On 24/11/2023 21.45, avi.e.gross@gmail.com wrote:
> > Grizz[l]y,
> >
> > I think the point is not about a sorted list or sorting in general It is
> > about reasons why maintaining a data structure such as a list in a program
> > can be useful beyond printing things once. There are many possible examples
> > such as having a list of lists containing a record where the third item is a
> > GPA for the student and writing a little list comprehension that selects a
> > smaller list containing only students who are Magna Cum Laude or Summa Cum
> > Laude.
> >
> > studs = [
> > ["Peter", 82, 3.53],
> > ["Paul", 77, 2.83],
> > ["Mary", 103, 3.82]
> > ]
>
> I've seen Mary, and she didn't look like a "stud" to me.
>

That's what happens when you abbreviate "student" though :) Don't
worry, there's far FAR worse around the place, and juvenile brains
will always find things to snigger at, usually in mathematical
libraries with "cumulative" functions.

ChrisA

Re: Newline (NuBe Question)

<mailman.295.1701000495.3828.python-list@python.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=28951&group=comp.lang.python#28951

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: roel@roelschroeven.net (Roel Schroeven)
Newsgroups: comp.lang.python
Subject: Re: Newline (NuBe Question)
Date: Sun, 26 Nov 2023 13:08:09 +0100
Lines: 45
Message-ID: <mailman.295.1701000495.3828.python-list@python.org>
References: <65547270.3139.338043@RealGrizzlyAdams.vivaldi.net>
<6555B48F.10108.156EC1@RealGrizzlyAdams.vivaldi.net>
<4626640f-4fe5-49bc-a6f8-d555b7f7b58a@tompassin.net>
<65561BDA.14413.9EACE9@RealGrizzlyAdams.vivaldi.net>
<016601da1f51$e4e84410$aeb8cc30$@gmail.com>
<mailman.289.1700883959.3828.python-list@python.org>
<ujt0i2$2r3tf$1@dont-email.me>
<9971c210-f777-41ea-b3b8-a3a429c65882@roelschroeven.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de lpqT7UGFnOk98gAxK/41Bgj7/16cfN+YXp02Xl+nruSQ==
Cancel-Lock: sha1:uNk65c10osTHHyPF96VGReTbwVQ= sha256:Kg8hM4hdsjbLKJWdd03Hfu1g9yBaOH4Km7J8uSsx4xE=
Return-Path: <roel@roelschroeven.net>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=roelschroeven.net header.i=@roelschroeven.net
header.b=s7tBTrCn; dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.007
X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'containing': 0.05;
'achieved': 0.07; 'field.': 0.07; 'modules': 0.07; 'intelligent':
0.09; 'library,': 0.09; 'smaller': 0.09; '&gt;': 0.14; '"list':
0.16; 'index:': 0.16; 'once.': 0.16; 'reasons."': 0.16;
'received:10.202': 0.16; 'received:10.202.2': 0.16;
'received:10.202.2.163': 0.16; 'received:internal': 0.16;
'received:messagingengine.com': 0.16; 'schreef': 0.16; 'sets,':
0.16; 'sorted': 0.16; 'strings,': 0.16; 'structures': 0.16;
'subject:Newline': 0.16; 'tuples': 0.16; 'tuples,': 0.16;
'tuples.': 0.16; 'whilst': 0.16; 'wrote:': 0.16; 'instead': 0.17;
'subject:Question': 0.19; 'to:addr:python-list': 0.20;
'\xe2\x80\x94': 0.22; 'student': 0.24; 'examples': 0.25; 'saying':
0.25; 'seems': 0.26; 'done': 0.28; 'suggest': 0.28; 'wrong': 0.28;
'header:User-Agent:1': 0.30; 'approach': 0.31; 'program': 0.31;
'think': 0.32; 'lists,': 0.32; 'maintaining': 0.32; 'objects':
0.32; 'python-list': 0.32; 'structure': 0.32; 'but': 0.32;
'there': 0.33; 'same': 0.34; 'printing': 0.34; 'header:In-Reply-
To:1': 0.34; 'item': 0.35; 'received:66': 0.35; 'work,': 0.36;
'people': 0.36; 'those': 0.36; 'lists': 0.37; 'using': 0.37;
'students': 0.38; 'list': 0.39; 'use': 0.39; 'serious': 0.40;
'michael': 0.60; 'likely': 0.61; 'skip:o 10': 0.61; 'me.': 0.62;
'ever': 0.63; 'email addr:gmail.com': 0.63; 'your': 0.64; 'less':
0.65; 'time.': 0.66; 'little': 0.73; 'man': 0.74; 'mr.': 0.78;
'water': 0.81; 'reasons': 0.84; 'cum': 0.84; 'dolphins': 0.84;
'said:': 0.84; 'selects': 0.84; 'adams': 0.91; 'avoiding': 0.91;
'believed': 0.93
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
roelschroeven.net; h=cc:content-type:content-type:date:date:from
:from:in-reply-to:in-reply-to:message-id:mime-version:references
:reply-to:sender:subject:subject:to:to; s=fm3; t=1701000491; x=
1701086891; bh=OhWQpDaGqcxeVFBs2zUw3sQmIKeyDNNXumXuyrk3oyQ=; b=s
7tBTrCnQ4AW6712+Umj/gL3TJSOA8CeYmjOdznOs5kk0DZUe1ONXVVMtLV8TTRAN
xXkcwhwFfF7p1Yq9lu4ZC959YP7d5qW/oQCkqc3Cl6Jc438p7X85lLU5lqP33JmO
5iYtwe7YyMv7LYcVsotEpUEGqxPnnn4pycrsYo8gtER6fDeVNM3dViSP6sIr4BsH
RzjaKLsUAQb4u8vtWTIveDegcB5/1SFgdZcfO6Hek9w2kVwiat3jUALLxpWb74GY
AaLNH8nOjPx700n/Mxm7UpDHm9pGMcrlsDt3L9+yAvB/lhJri2jS2NyAobVdVct9
dYrRz1g8emyIxckbK6iCA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
messagingengine.com; h=cc:content-type:content-type:date:date
:feedback-id:feedback-id:from:from:in-reply-to:in-reply-to
:message-id:mime-version:references:reply-to:sender:subject
:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender
:x-sasl-enc; s=fm1; t=1701000491; x=1701086891; bh=OhWQpDaGqcxeV
FBs2zUw3sQmIKeyDNNXumXuyrk3oyQ=; b=t9qKzUjnrmbjs0/2ZVuqioG2sR8Xk
rpR7nh0HIId2oYQODqtU+DUnGD68fzjq1Z2bxwPRSmz5Qj6D84uc2irkxV492MgM
6CNdGxzW4qjC3HUd9AVVuDk8t0ec03oKbsAJAGkT3oCdwOu1pCTA8D2StTQHkVM8
51gyzSrqiGnunNLwd/VrIhGzX7/D2ACrRcq28TnVMw3PQR4gHft8GPBPMzK0X50R
W4yZ3EAgFjh1p4S4c31zKq8PIrx0L4DlIhHdzxlznzIiRvEFzntiqE0Q0aZjHpEx
uxkNbOyS76H6vVqs9xbQH+OtGqV2QnQ3gP3MHr69umm/WVggGQYalD4Qw==
X-ME-Sender: <xms:KzVjZdcq5oAUevoaN9LV3sVsB5OxHAgQ3fwSh4WtoaL1aKTNy6culg>
<xme:KzVjZbODp-TiU7EtbvVaLqd-AgKSp5QGPrke-EZzeiF5TSzr5aaiD2kt4o5prD8jG
xUgK0gA00cB>
X-ME-Received: <xmr:KzVjZWg9CnYZNRAMakmsheQMlL2XpABAhYXNsAt18ImSWLzys4NdyTuPtxatq1ArNsUSONpYQa5pNkH5BT2SaWt0qojWdXA>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudehledgfeekucetufdoteggodetrfdotf
fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
uceurghilhhouhhtmecufedttdenucenucfjughrpegtkfffgggfuffvfhfhjgesrgdtre
ertddvjeenucfhrhhomheptfhovghlucfutghhrhhovghvvghnuceorhhovghlsehrohgv
lhhstghhrhhovghvvghnrdhnvghtqeenucggtffrrghtthgvrhhnpedvfeffvdeuudduke
dvvdefuedthedvleefleekgeekfeetheeiteffhfffudeggeenucevlhhushhtvghrufhi
iigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehrohgvlhesrhhovghlshgthhhroh
gvvhgvnhdrnhgvth
X-ME-Proxy: <xmx:KzVjZW8BS4a7FHMJyV0Uh5qKnwe3IbcJEYnE9MKenmqRGHSwz3oLmA>
<xmx:KzVjZZsa0WEf_J1pvqHh7wu3pOKRc5_hbzVlsE90PSiOj7iXt3nCAw>
<xmx:KzVjZVEyuvUt53BsmMNB48vWTNPR69YUCdRkW4erc08QEKDUe-iBxQ>
<xmx:KzVjZe5ZByrum_cOOBZhnQdsOtQpvDjlKaxUHIHTaMqbS60MuaGw5Q>
Feedback-ID: i8e5b41ae:Fastmail
User-Agent: Mozilla Thunderbird
Content-Language: en-GB
In-Reply-To: <ujt0i2$2r3tf$1@dont-email.me>
X-Content-Filtered-By: Mailman/MimeDel 2.1.39
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <9971c210-f777-41ea-b3b8-a3a429c65882@roelschroeven.net>
X-Mailman-Original-References: <65547270.3139.338043@RealGrizzlyAdams.vivaldi.net>
<6555B48F.10108.156EC1@RealGrizzlyAdams.vivaldi.net>
<4626640f-4fe5-49bc-a6f8-d555b7f7b58a@tompassin.net>
<65561BDA.14413.9EACE9@RealGrizzlyAdams.vivaldi.net>
<016601da1f51$e4e84410$aeb8cc30$@gmail.com>
<mailman.289.1700883959.3828.python-list@python.org>
<ujt0i2$2r3tf$1@dont-email.me>
 by: Roel Schroeven - Sun, 26 Nov 2023 12:08 UTC

Michael F. Stemper via Python-list schreef op 25/11/2023 om 15:32:
> On 24/11/2023 21.45,avi.e.gross@gmail.com wrote:
> > Grizz[l]y,
> >
> > I think the point is not about a sorted list or sorting in general It is
> > about reasons why maintaining a data structure such as a list in a program
> > can be useful beyond printing things once. There are many possible examples
> > such as having a list of lists containing a record where the third item is a
> > GPA for the student and writing a little list comprehension that selects a
> > smaller list containing only students who are Magna Cum Laude or Summa Cum
> > Laude.
> >
> > studs = [
> > ["Peter", 82, 3.53],
> > ["Paul", 77, 2.83],
> > ["Mary", 103, 3.82]
> > ]
>
> > Of course, for serious work, some might suggest avoiding constructs like a
> > list of lists and switch to using modules and data structures [...]
>
> Those who would recommend that approach do not appear to include Mr.
> Rossum, who said:
>
> Avoid overengineering data structures. Tuples are better than
> objects (try namedtuple too though). Prefer simple fields over
> getter/setter functions... Built-in datatypes are your friends.
> Use more numbers, strings, tuples, lists, sets, dicts. Also
> check out the collections library, eps. deque.[1]
>
> I was nodding along with the people saying "list of lists" until I
> reread this quote. A list of tuples seems most appropriate to me.

I prefer namedtuples or dataclasses over tuples. They allow you to refer
to their fields by name instead of index: student.gpa is much clearer
than student[2], and makes it less likely to accidentally refer to the
wrong field.

--
"Man had always assumed that he was more intelligent than dolphins because
he had achieved so much — the wheel, New York, wars and so on — whilst all
the dolphins had ever done was muck about in the water having a good time.
But conversely, the dolphins had always believed that they were far more
intelligent than man — for precisely the same reasons."
-- Douglas Adams

RE: RE: Newline (NuBe Question)

<mailman.297.1701025603.3828.python-list@python.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=28956&group=comp.lang.python#28956

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: <avi.e.gross@gmail.com>
Newsgroups: comp.lang.python
Subject: RE: RE: Newline (NuBe Question)
Date: Sun, 26 Nov 2023 14:06:37 -0500
Lines: 136
Message-ID: <mailman.297.1701025603.3828.python-list@python.org>
References: <65547270.3139.338043@RealGrizzlyAdams.vivaldi.net>
<6555B48F.10108.156EC1@RealGrizzlyAdams.vivaldi.net>
<4626640f-4fe5-49bc-a6f8-d555b7f7b58a@tompassin.net>
<65561BDA.14413.9EACE9@RealGrizzlyAdams.vivaldi.net>
<016601da1f51$e4e84410$aeb8cc30$@gmail.com>
<mailman.289.1700883959.3828.python-list@python.org>
<ujt0i2$2r3tf$1@dont-email.me>
<003901da209b$aed7d110$0c877330$@gmail.com>
Mime-Version: 1.0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de 6dvYGR58saXAwRbr9VFuUA01aKHX3qj0J7LLLzlK8ddg==
Cancel-Lock: sha1:UKd4xrJ1T2/2/hdD7dNhNN1Xx/o= sha256:qgoW6BOZEO54p3dZNfxj6pmkizKK+etCq0ee1b0pY7Q=
Return-Path: <avi.e.gross@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=XWXJ1wGv;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.000
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'url-ip:140.82.114.3/32':
0.03; 'url-ip:140.82.114/24': 0.03; 'url-ip:140.82/16': 0.03;
'csv': 0.03; 'knows': 0.04; 'containing': 0.05; 'fairly': 0.05;
'2023': 0.07; 'arrays': 0.07; 'graphics': 0.07; 'guido': 0.07;
'modules': 0.07; '<>,': 0.09; 'attempts': 0.09; 'fewer': 0.09;
'floating': 0.09; 'library,': 0.09; 'numpy': 0.09; 'pandas': 0.09;
'received:108': 0.09; 'simplicity': 0.09; 'smaller': 0.09;
'url:github': 0.14; 'import': 0.15; 'url:mailman': 0.15; 'that.':
0.15; 'url-ip:140/8': 0.15; '"list': 0.16; 'accessed': 0.16;
'calculation': 0.16; 'calculations': 0.16; 'columns': 0.16;
'compiled': 0.16; 'idea.': 0.16; 'indeed': 0.16; 'length.': 0.16;
'mathematical': 0.16; 'newline': 0.16; 'norm': 0.16; 'numpy,':
0.16; 'once.': 0.16; 'packages.': 0.16; 'paradigms': 0.16;
'resulted': 0.16; 'sets,': 0.16; 'somewhat': 0.16; 'sorted': 0.16;
'specify': 0.16; 'strings,': 0.16; 'structures': 0.16;
'subject:Newline': 0.16; 'things,': 0.16; 'think.': 0.16;
'tuples': 0.16; 'tuples,': 0.16; 'wrote:': 0.16; 'python': 0.16;
'instead': 0.17; 'message-id:@gmail.com': 0.18; 'it?': 0.19;
'subject:Question': 0.19; 'to:addr:python-list': 0.20; 'language':
0.21; 'written': 0.22; "i've": 0.22; 'languages': 0.22; 'teach':
0.22; 'version': 0.23; 'code': 0.23; 'student': 0.24; 'idea':
0.24; 'skip:- 10': 0.25; 'url-ip:188.166.95.178/32': 0.25; 'url-
ip:188.166.95/24': 0.25; 'python,': 0.25; 'examples': 0.25;
'saying': 0.25; 'url:listinfo': 0.25; 'cannot': 0.25; 'url-
ip:188.166/16': 0.25; 'anyone': 0.25; 'seems': 0.26; 'basics':
0.26; 'library': 0.26; 'normally': 0.26; 'notes': 0.26;
'creating': 0.27; 'bit': 0.27; 'done': 0.28; 'sense': 0.28;
'ideas': 0.28; 'suggest': 0.28; 'recently': 0.29; 'packages':
0.31; 'approach': 0.31; 'before.': 0.31; 'url-ip:188/8': 0.31;
'program': 0.31; 'think': 0.32; 'language.': 0.32; 'lists,': 0.32;
'maintaining': 0.32; 'manipulate': 0.32; 'objects': 0.32; 'python-
list': 0.32; 'regard': 0.32; 'structure': 0.32; 'but': 0.32;
'there': 0.33; 'earlier': 0.67; '[1]': 0.67; 'bad': 0.67; 'body':
0.67; 'entire': 0.67; 'stand': 0.67; 'away': 0.67; 'order': 0.69;
'complexity': 0.69; 'recipe': 0.69; 'sentence': 0.69; 'within':
0.69; 'resulting': 0.70; 'speed': 0.71; 'little': 0.73; 'easy':
0.74; 'features': 0.75; 'chain': 0.76; 'implemented': 0.76;
'sent:': 0.78; 'mr.': 0.78; 'depth': 0.81; 'more.': 0.82;
'reasons': 0.84; 'ages': 0.84; 'assembled': 0.84; 'became': 0.84;
'car': 0.84; 'cum': 0.84; 'dealt': 0.84; 'disagree': 0.84;
'improvement.': 0.84; 'method,': 0.84; 'received:mail-
qk1-x735.google.com': 0.84; 'said:': 0.84; 'saturday,': 0.84;
'selects': 0.84; 'want.': 0.84; 'avoiding': 0.91; '(all': 0.93;
'bill': 0.95
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1701025600; x=1701630400; darn=python.org;
h=thread-index:content-language:content-transfer-encoding
:mime-version:message-id:date:subject:in-reply-to:references:to:from
:from:to:cc:subject:date:message-id:reply-to;
bh=Lx8RksKbaQiy1vn7O2r4JMGOIwzx/qqJLeBa8zafHcI=;
b=XWXJ1wGvxFfXtaN7JmsACZxPbZpGS7qaLnaLsviudtqUQodmGelh+ci5yjEwcmuWlu
JiZJ4C7McjRgm0MutQppHKXJO0nu9Cs3G2n6Yb8Gt6GqFMsL80nfxYqgDqtei6Xqgoby
js0CuY//PK0NlGoSFK1snVjVQhwQv7dlhRXeuswfBUVLLy2Sfvl1Bhf3ZutRJgHF9pJ6
oY5eh44cypUll9i2CZz33fCxAgYiducIdbROoAjGsnaUay8F71qOIRRWIdlhM7qD0L3a
MHu70SrZRoy46oSzXKD5obIdmpTmpwc26nrpLOPX9iIeoDJur302J7YK3wiCTvoH/pyy
4png==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1701025600; x=1701630400;
h=thread-index:content-language:content-transfer-encoding
:mime-version:message-id:date:subject:in-reply-to:references:to:from
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=Lx8RksKbaQiy1vn7O2r4JMGOIwzx/qqJLeBa8zafHcI=;
b=JlaiWKAyntA+5yPiujGtqiJ7X6kWGbjfEdtPNJW0vunC+mgZfJkORCiaudfFs91vFM
QbQFigExWfRVhHZxQohWll4tzzbVlFeCIzvJhw3LE+l0KM5cN3U7hGr7Fqs7/iCuOgu/
SN/Xq2KaIVbDgeMZs1aI0uw9hlOjRtA3e9MYBBJzDydbltphjqPeIXnYlgbwXX6Tetc0
dRqzCmx3eg+V7v89hOFkCUWAzausnOemBPf+54GMRoSrskUJiBMELCFzcna0Guf8eW7s
peBj+mlvQZ0S7j/jQ9A1lJKmi6PSwkKUozlKkMw0PGUcn0YIFI6jlKPS5XlZHO7FZxD7
k2nA==
X-Gm-Message-State: AOJu0Yx2lAcEDiUlmXRx7cTRHEtxRsAEJeyUxCGn7/N6LdhE/cBiOycS
6KM7Fau4dyyDg0tJUGXucqzE/V+v3kQ=
X-Google-Smtp-Source: AGHT+IGt3FYkNafRSE/jrqqYxJyFdnPqclzoCQG7It92MJgnWXrZUPiwTfnIB38zF68YlWznAdnn2Q==
X-Received: by 2002:a05:6214:2d0f:b0:67a:2012:b9a1 with SMTP id
mz15-20020a0562142d0f00b0067a2012b9a1mr7316646qvb.55.1701025600016;
Sun, 26 Nov 2023 11:06:40 -0800 (PST)
In-Reply-To: <ujt0i2$2r3tf$1@dont-email.me>
X-Mailer: Microsoft Outlook 16.0
Content-Language: en-us
Thread-Index: AQLE5XCijAbYn+n7sN9UKc2YtIQx7wCvRdtIAgiVzWYCiv+1DAItEPQ6Aq35/mwBgwsbAK5aZORA
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <003901da209b$aed7d110$0c877330$@gmail.com>
X-Mailman-Original-References: <65547270.3139.338043@RealGrizzlyAdams.vivaldi.net>
<6555B48F.10108.156EC1@RealGrizzlyAdams.vivaldi.net>
<4626640f-4fe5-49bc-a6f8-d555b7f7b58a@tompassin.net>
<65561BDA.14413.9EACE9@RealGrizzlyAdams.vivaldi.net>
<016601da1f51$e4e84410$aeb8cc30$@gmail.com>
<mailman.289.1700883959.3828.python-list@python.org>
<ujt0i2$2r3tf$1@dont-email.me>
 by: <avi.e.gross@gmail.com> - Sun, 26 Nov 2023 19:06 UTC

That is an entirely different discussion, Michael.

I do not know what ideas Guido had ages ago and where he might stand now and
I actually seriously disagree with the snippet you quoted below.

Python was started long ago as a way to improve in some ways on what was
there before. Some of the ideas were nice but also for some purposes, way
too slow.

If you regard the original versions of LISP, they too simplicity to an
extreme and pretty much the main or even only data structure was a list.
Functions like CAR and CDR accessed an element but a complex structure
resulted in people creating functions with names like CAAAAAR and CADADADR
to automate climbing a tree of sorts to get to the parts you want. It was a
recipe for complexity and errors.

My point was that although a list can do so many things in principle, it is
not really optimized to do some things that can be way easier using add-ons
or your own data structures like objects and he notes the collection library
and deque as an example that he is not as much of a purist as you may think.

My point was that if you have a fairly detailed and complex application that
will manipulate lots of data, then instead of reading in a CSV with many
columns and rows recorded into a list of lists, it may make sense to import
numpy and pandas that come with all kinds of functionality built in so you
do not need to re-invent everything. Just how easy is it using lists of
lists to rearrange the order of columns of data, or add new columns
containing calculations built from existing columns and so on?

Of course, for many purposes, it is indeed overkill albeit once you learn a
method, ...

I think part of the design of Python, and this is just my guess, included
going away from overly specific things done in earlier compiled languages
and making it more abstract and inclusive. Arrays or vectors or other such
names would normally require everything to be of the same data type and with
a fixed length. The list data structure loosened this up quite a bit and
also allowed lists within lists. That is great and for some purposes, not
very efficient and especially not when your data actually is all of the same
type or of fixed length. You can make matrix-like data structures of any
depth using lists and it may be hard to traverse such as when you want to
multiply two such 2-D matrices. Place the same data (all say floating point
numbers) in a vector-like structure that also has stored info about the
dimensions, and a simple mathematical calculation accesses any item such as
may_tricks[5,42] in the same amount of time as an offset from the top.

I have seen this phenomenon in many languages where a somewhat clean and
sparse design gets added to, often by others, until some core features are
used less often. An example would be R which does have lists nut they are
just one form of vectors which are really more the core data idea. It also
contains data.frames in the core which are implemented as a list of vectors
and more recently a bit more. It was designed to do statistical tasks as one
of the main objectives. Yet the graphics functions have been added to so
there are by now quite a few independent ways to make graphics using
different paradigms. Python also has something like that. And completely new
paradigms such as piping data in a chain were added in packages and it
became so popular that a version has been added to the core language.

Now although the core language includes lots of the functionality you might
see in numpy/pandas and you can do all kinds of things, some others kept
creating new ways to do things including different data structures that
either dealt with weaknesses found or were ore efficient and so on and an
entire growing body of alternate ways to do things with lots more power and
often more speed that I prefer. A collection of lots of these alternative
packages has been assembled and I and others often simply start programs by
including the "tidyverse" and the resulting programs might as well be
written in a different language to anyone who only knows base R.

But I do not see that as a bad thing albeit someone trying to get a part of
a program from an AI-like service may need to specify or they may get code
they cannot trivially read and evaluate but that works fine once they have
loaded the packages.

Guido is like many others who create or invent and do it in the way they are
proud of. Why change it? But the reality is that first attempts are often
done with lots of room for change and improvement. Now if you are teaching a
course on Python basics, it may be a good idea to teach the basics and
require students to only use in their homework what has already been taught.
But if you get a job where the norm is to use modules like numpy, it makes
sense to use the expanded language if it results in faster writing perhaps
of faster code with fewer mistakes.
-----Original Message-----
From: Python-list <python-list-bounces+avi.e.gross=gmail.com@python.org> On
Behalf Of Michael F. Stemper via Python-list
Sent: Saturday, November 25, 2023 9:32 AM
To: python-list@python.org
Subject: Re: RE: Newline (NuBe Question)

On 24/11/2023 21.45, avi.e.gross@gmail.com wrote:
> Grizz[l]y,
>
> I think the point is not about a sorted list or sorting in general It is
> about reasons why maintaining a data structure such as a list in a program
> can be useful beyond printing things once. There are many possible
examples
> such as having a list of lists containing a record where the third item is
a > GPA for the student and writing a little list comprehension that selects a
> smaller list containing only students who are Magna Cum Laude or Summa Cum
> Laude.
>
> studs = [
> ["Peter", 82, 3.53],
> ["Paul", 77, 2.83],
> ["Mary", 103, 3.82]
> ]

I've seen Mary, and she didn't look like a "stud" to me.

> Of course, for serious work, some might suggest avoiding constructs like a
> list of lists and switch to using modules and data structures [...]

Those who would recommend that approach do not appear to include Mr.
Rossum, who said:

Avoid overengineering data structures. Tuples are better than
objects (try namedtuple too though). Prefer simple fields over
getter/setter functions... Built-in datatypes are your friends.
Use more numbers, strings, tuples, lists, sets, dicts. Also
check out the collections library, eps. deque.[1]

I was nodding along with the people saying "list of lists" until I
reread this quote. A list of tuples seems most appropriate to me.


[1] <https://gist.github.com/hemanth/3715502>, as quoted by Bill
Lubanovic in _Introducing Python_

--
Michael F. Stemper
This sentence no verb.

--
https://mail.python.org/mailman/listinfo/python-list

RE: RE: Newline (NuBe Question)

<mailman.298.1701026118.3828.python-list@python.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=28957&group=comp.lang.python#28957

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!rocksolid2!news.neodome.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: <avi.e.gross@gmail.com>
Newsgroups: comp.lang.python
Subject: RE: RE: Newline (NuBe Question)
Date: Sun, 26 Nov 2023 14:15:13 -0500
Lines: 60
Message-ID: <mailman.298.1701026118.3828.python-list@python.org>
References: <65547270.3139.338043@RealGrizzlyAdams.vivaldi.net>
<6555B48F.10108.156EC1@RealGrizzlyAdams.vivaldi.net>
<4626640f-4fe5-49bc-a6f8-d555b7f7b58a@tompassin.net>
<65561BDA.14413.9EACE9@RealGrizzlyAdams.vivaldi.net>
<016601da1f51$e4e84410$aeb8cc30$@gmail.com>
<mailman.289.1700883959.3828.python-list@python.org>
<ujt0i2$2r3tf$1@dont-email.me>
<CAPTjJmo2cZjPvC8_=0vbQAyhA4t5LS-c=QCekZqmpWogxCJo6Q@mail.gmail.com>
<005201da209c$e1bb0c90$a53125b0$@gmail.com>
Mime-Version: 1.0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de 6mMMRp8xwsQnhIN9ZYILVgtnBlw5UksmDjvPbrJQu6gw==
Cancel-Lock: sha1:m55p6psVzlvPaHmhqiscv/OrWlg= sha256:aQSEndhptUnGNYORTzf4yuxFXfsR5ghvZk7fRzWWm0I=
Return-Path: <avi.e.gross@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=D5R3mjC1;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.018
X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'containing': 0.05; '2023':
0.07; '26,': 0.07; 'sun,': 0.07; 'angelico': 0.09; 'fyi,': 0.09;
'received:108': 0.09; 'smaller': 0.09; 'url:mailman': 0.15;
'...]': 0.16; 'chrisa': 0.16; 'discussions.': 0.16; 'functions.':
0.16; 'mathematical': 0.16; 'newline': 0.16; 'once.': 0.16;
'sorted': 0.16; 'subject:Newline': 0.16; 'wrote:': 0.16; 'message-
id:@gmail.com': 0.18; 'libraries': 0.19; 'subject:Question': 0.19;
'to:addr:python-list': 0.20; "i've": 0.22; 'student': 0.24;
'anything': 0.25; 'skip:- 10': 0.25; 'url-ip:188.166.95.178/32':
0.25; 'url-ip:188.166.95/24': 0.25; 'examples': 0.25;
'url:listinfo': 0.25; 'cannot': 0.25; 'url-ip:188.166/16': 0.25;
'do?': 0.26; 'party': 0.26; 'chris': 0.28; 'url-ip:188/8': 0.31;
'program': 0.31; 'think': 0.32; 'maintaining': 0.32; 'python-
list': 0.32; 'structure': 0.32; 'but': 0.32; 'there': 0.33;
"didn't": 0.34; 'printing': 0.34; 'header:In-Reply-To:1': 0.34;
'received:google.com': 0.34; 'item': 0.35; 'words': 0.35;
'from:addr:gmail.com': 0.35; 'people': 0.36; 'lists': 0.37;
'though': 0.37; 'students': 0.38; 'two': 0.39; 'list': 0.39;
'happen': 0.40; 'learn': 0.40; 'michael': 0.60; "there's": 0.61;
'from:': 0.62; 'me.': 0.62; 'to:': 0.62; 'seen': 0.62; 'ever':
0.63; 'email addr:gmail.com': 0.63; 'feel': 0.63; 'she': 0.64;
'gender': 0.64; 're:': 0.64; 'look': 0.65; 'little': 0.73;
'sent:': 0.78; 'happens': 0.84; 'reasons': 0.84; 'chose': 0.84;
'cum': 0.84; 'received:mail-qv1-xf2d.google.com': 0.84; 'selects':
0.84; 'deliberately': 0.91
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1701026115; x=1701630915; darn=python.org;
h=thread-index:content-language:content-transfer-encoding
:mime-version:message-id:date:subject:in-reply-to:references:to:from
:from:to:cc:subject:date:message-id:reply-to;
bh=qmK+8Ir7NfSx9gmmQ0kXDeqGZ3uLlDDBOj+RgLxncls=;
b=D5R3mjC1Nh6XPKcaCYbcpm2HuIeEXO26xvrzko/qCOKtVMBleu1+gPqL0fpvMW5KXJ
7qkUzTnRG3noNlgfC1uRIFRbwYusUQMW5OgSe/AJmTgpOojlEKGromVWnAq4y9rU7dyy
QCZEtUuO+OtPznYfMrGHM8hsYx34tupOe/B7Ox11dkEuy+wB+ORdSS8i6oCU3abfDJXC
7SqqmiCFS+qR1/DK4lTdUxCDXogMdPKZ1FTA4KH8b8T+jmGqhVp8njs6ElczwHDOM5qH
9JkocPw6nQCHiq1+L+R9yTAAaEOQnybqN9gO0cTs0VidEaIPrVcY065tppltqQdpzBid
KWHw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1701026115; x=1701630915;
h=thread-index:content-language:content-transfer-encoding
:mime-version:message-id:date:subject:in-reply-to:references:to:from
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=qmK+8Ir7NfSx9gmmQ0kXDeqGZ3uLlDDBOj+RgLxncls=;
b=OgeSdhLq++bDtCkBRPDQJdF6FYAVzatC0SzmJXHtmYWZWlBe+uOTndgBRF8k1n56AK
mfWPlxSjHlpHkjE8lxj11DePOLnKVJdjUNe6Q4yBZURXVDB6L8v4YY5HRlEfqk4/Ok0k
5An4n47DpWN5XV9+Xbj70mBNdL8NNUkTfahAgi7ky/OSCUIvo0jiaOUSD/zTiezVq8iB
sjAnL6iTRlzNWKmPxr3wwayUNZt4bZXzxqS7DVBdIaKbfeT9b1RhkNaBSXbltjF0whmz
pI0D2z6cERTxEohSYzRwsLege+x8RseRpOVnLeaES2dLQghL9uX+DbHwVZujAQMFhx7r
K6DA==
X-Gm-Message-State: AOJu0YxaVbBAC+miGvd1JAxMGfa5YvNlga/cs5rG+QqCVopL3TtfwzQd
OTcTOCztRE8NLWGgLabmqSOfD9c5CMc=
X-Google-Smtp-Source: AGHT+IF+SsNVISWpIuJ/Zr0hHitcNlD3+TWqIO1sAdQkQbvBxmuDb7EsL5VVVp137kf8IomAno4TJQ==
X-Received: by 2002:a05:6214:5809:b0:679:f5ba:cc42 with SMTP id
mk9-20020a056214580900b00679f5bacc42mr10106880qvb.5.1701026114713;
Sun, 26 Nov 2023 11:15:14 -0800 (PST)
In-Reply-To: <CAPTjJmo2cZjPvC8_=0vbQAyhA4t5LS-c=QCekZqmpWogxCJo6Q@mail.gmail.com>
X-Mailer: Microsoft Outlook 16.0
Content-Language: en-us
Thread-Index: AQLE5XCijAbYn+n7sN9UKc2YtIQx7wCvRdtIAgiVzWYCiv+1DAItEPQ6Aq35/mwBgwsbAAJH5KpPrkgmkmA=
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <005201da209c$e1bb0c90$a53125b0$@gmail.com>
X-Mailman-Original-References: <65547270.3139.338043@RealGrizzlyAdams.vivaldi.net>
<6555B48F.10108.156EC1@RealGrizzlyAdams.vivaldi.net>
<4626640f-4fe5-49bc-a6f8-d555b7f7b58a@tompassin.net>
<65561BDA.14413.9EACE9@RealGrizzlyAdams.vivaldi.net>
<016601da1f51$e4e84410$aeb8cc30$@gmail.com>
<mailman.289.1700883959.3828.python-list@python.org>
<ujt0i2$2r3tf$1@dont-email.me>
<CAPTjJmo2cZjPvC8_=0vbQAyhA4t5LS-c=QCekZqmpWogxCJo6Q@mail.gmail.com>
 by: <avi.e.gross@gmail.com> - Sun, 26 Nov 2023 19:15 UTC

Just FYI, I deliberately chose that abbreviation for a sort of irony as for
some people college is about almost anything except learning and some people
think they are studs and just party and ...

And I am very tired of gender discussions. Lots of words now include two or
even more genders. Women are often now "actors", not actresses. I see no
reason women cannot be studs!

But I learn from criticism. If I ever write a program like that and do not
feel like typing, will this do?

dents = [ ...]

Or will that not include students who happen to be edentulous?

-----Original Message-----
From: Python-list <python-list-bounces+avi.e.gross=gmail.com@python.org> On
Behalf Of Chris Angelico via Python-list
Sent: Sunday, November 26, 2023 6:49 AM
To: python-list@python.org
Subject: Re: RE: Newline (NuBe Question)

On Sun, 26 Nov 2023 at 21:08, Michael F. Stemper via Python-list
<python-list@python.org> wrote:
>
> On 24/11/2023 21.45, avi.e.gross@gmail.com wrote:
> > Grizz[l]y,
> >
> > I think the point is not about a sorted list or sorting in general It is
> > about reasons why maintaining a data structure such as a list in a
program
> > can be useful beyond printing things once. There are many possible
examples
> > such as having a list of lists containing a record where the third item
is a
> > GPA for the student and writing a little list comprehension that selects
a > > smaller list containing only students who are Magna Cum Laude or Summa
Cum
> > Laude.
> >
> > studs = [
> > ["Peter", 82, 3.53],
> > ["Paul", 77, 2.83],
> > ["Mary", 103, 3.82]
> > ]
>
> I've seen Mary, and she didn't look like a "stud" to me.
>

That's what happens when you abbreviate "student" though :) Don't
worry, there's far FAR worse around the place, and juvenile brains
will always find things to snigger at, usually in mathematical
libraries with "cumulative" functions.

ChrisA
--
https://mail.python.org/mailman/listinfo/python-list

Re: Newline (NuBe Question)

<mailman.299.1701033062.3828.python-list@python.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=28960&group=comp.lang.python#28960

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: hjp-python@hjp.at (Peter J. Holzer)
Newsgroups: comp.lang.python
Subject: Re: Newline (NuBe Question)
Date: Sun, 26 Nov 2023 22:04:09 +0100
Lines: 58
Message-ID: <mailman.299.1701033062.3828.python-list@python.org>
References: <65547270.3139.338043@RealGrizzlyAdams.vivaldi.net>
<6555B48F.10108.156EC1@RealGrizzlyAdams.vivaldi.net>
<4626640f-4fe5-49bc-a6f8-d555b7f7b58a@tompassin.net>
<65561BDA.14413.9EACE9@RealGrizzlyAdams.vivaldi.net>
<016601da1f51$e4e84410$aeb8cc30$@gmail.com>
<mailman.289.1700883959.3828.python-list@python.org>
<ujt0i2$2r3tf$1@dont-email.me>
<20231126210409.wbcdjkuxmwh7l23q@hjp.at>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha512;
protocol="application/pgp-signature"; boundary="nlqykz4f2kzdfegu"
X-Trace: news.uni-berlin.de vS9h7K1YhccxNRV5uYn7jQoz1pZM0SQ8Xd0+Uv5SEmrQ==
Cancel-Lock: sha1:ToGd5oQSkH4Vdgx/fJDwwtEqkp0= sha256:qXrhPNDPppDZ1qR0QqZ/uWo+DJqeI0b565LKwKaqFvE=
Return-Path: <hjp-python@hjp.at>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.001
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'content-
type:multipart/signed': 0.05; 'guido': 0.07; 'modules': 0.07;
'content-type:application/pgp-signature': 0.09; 'filename:fname
piece:asc': 0.09; 'filename:fname piece:signature': 0.09;
'filename:fname:signature.asc': 0.09; 'objects,': 0.09; 'skip:^
10': 0.09; '"creative': 0.16; '__/': 0.16; 'challenge!"': 0.16;
'from:addr:hjp-python': 0.16; 'from:addr:hjp.at': 0.16;
'from:name:peter j. holzer': 0.16; 'hjp@hjp.at': 0.16; 'holzer':
0.16; 'objects.': 0.16; 'reality.': 0.16; 'stross,': 0.16;
'structures': 0.16; 'subject:Newline': 0.16; 'tuples': 0.16; 'url-
ip:212.17.106/24': 0.16; 'url-ip:212.17/16': 0.16; 'url:hjp':
0.16; '|_|_)': 0.16; 'wrote:': 0.16; 'python': 0.16;
'subject:Question': 0.19; 'to:addr:python-list': 0.20; 'language':
0.21; 'sense': 0.28; 'suggest': 0.28; 'approach': 0.31; 'context':
0.32; 'objects': 0.32; 'python-list': 0.32; "wouldn't": 0.32;
'but': 0.32; 'header:In-Reply-To:1': 0.34; '"if': 0.35; 'work,':
0.36; 'those': 0.36; 'lists': 0.37; 'using': 0.37; 'list': 0.39;
'serious': 0.40; 'michael': 0.60; 'skip:o 10': 0.61;
'received:212': 0.62; 'here': 0.62; 'email addr:gmail.com': 0.63;
'key': 0.64; 'received:userid': 0.66; 'url-ip:212/8': 0.69;
'skip:* 10': 0.71; 'mr.': 0.78; 'received:at': 0.84; 'said:':
0.84; 'avoiding': 0.91
Mail-Followup-To: python-list@python.org
Content-Disposition: inline
In-Reply-To: <ujt0i2$2r3tf$1@dont-email.me>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <20231126210409.wbcdjkuxmwh7l23q@hjp.at>
X-Mailman-Original-References: <65547270.3139.338043@RealGrizzlyAdams.vivaldi.net>
<6555B48F.10108.156EC1@RealGrizzlyAdams.vivaldi.net>
<4626640f-4fe5-49bc-a6f8-d555b7f7b58a@tompassin.net>
<65561BDA.14413.9EACE9@RealGrizzlyAdams.vivaldi.net>
<016601da1f51$e4e84410$aeb8cc30$@gmail.com>
<mailman.289.1700883959.3828.python-list@python.org>
<ujt0i2$2r3tf$1@dont-email.me>
 by: Peter J. Holzer - Sun, 26 Nov 2023 21:04 UTC
Attachments: signature.asc (application/pgp-signature)

On 2023-11-25 08:32:24 -0600, Michael F. Stemper via Python-list wrote:
> On 24/11/2023 21.45, avi.e.gross@gmail.com wrote:
> > Of course, for serious work, some might suggest avoiding constructs like a
> > list of lists and switch to using modules and data structures [...]
>
> Those who would recommend that approach do not appear to include Mr.
> Rossum, who said:
> Avoid overengineering data structures.
^^^^^^^^^^^^^^^

The key point here is *over*engineering. Don't make things more
complicated than they need to be. But also don't make them simpler than
necessary.

> Tuples are better than objects (try namedtuple too though).

If Guido thought that tuples would always be better than objects, then
Python wouldn't have objects. Why would he add such a complicated
feature to the language if he thought it was useless?

The (unspoken?) context here is "if tuples are sufficient, then ..."

hp

--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | hjp@hjp.at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"

Attachments: signature.asc (application/pgp-signature)
Re: Newline (NuBe Question)

<mailman.300.1701035900.3828.python-list@python.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=28961&group=comp.lang.python#28961

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!rocksolid2!news.neodome.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: PythonList@danceswithmice.info (DL Neil)
Newsgroups: comp.lang.python
Subject: Re: Newline (NuBe Question)
Date: Mon, 27 Nov 2023 10:58:08 +1300
Lines: 52
Message-ID: <mailman.300.1701035900.3828.python-list@python.org>
References: <65547270.3139.338043@RealGrizzlyAdams.vivaldi.net>
<6555B48F.10108.156EC1@RealGrizzlyAdams.vivaldi.net>
<4626640f-4fe5-49bc-a6f8-d555b7f7b58a@tompassin.net>
<65561BDA.14413.9EACE9@RealGrizzlyAdams.vivaldi.net>
<016601da1f51$e4e84410$aeb8cc30$@gmail.com>
<mailman.289.1700883959.3828.python-list@python.org>
<ujt0i2$2r3tf$1@dont-email.me>
<CAPTjJmo2cZjPvC8_=0vbQAyhA4t5LS-c=QCekZqmpWogxCJo6Q@mail.gmail.com>
<765911b5-b673-4d3b-b7e4-3bd0ea94bf3d@danceswithmice.info>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de T2hHT7ct+qm//w6d1L3TjAdL9huNXD9r990OFx8Rq+BA==
Cancel-Lock: sha1:phxohqluNV81wbUnGDAGmr7oFs0= sha256:VvgnMnqq3/i6uGFBM1MR4WzAIL0rOVv4oYIBg6J9ylo=
Return-Path: <PythonList@danceswithmice.info>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=danceswithmice.info header.i=@danceswithmice.info
header.b=C5IMOHAt; dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.001
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'containing': 0.05; '2023':
0.07; 'sun,': 0.07; 'wanting': 0.07; '=dn': 0.09; 'angelico':
0.09; 'from:addr:danceswithmice.info': 0.09;
'from:addr:pythonlist': 0.09; 'from:name:dl neil': 0.09; 'lazy':
0.09; 'meant': 0.09; 'smaller': 0.09; 'domain?': 0.16;
'functions.': 0.16; 'funny,': 0.16; 'mary': 0.16; 'mathematical':
0.16; 'once.': 0.16; 'over?': 0.16; 'received:51.254': 0.16;
'received:51.254.211': 0.16; 'received:51.254.211.219': 0.16;
'received:cloud': 0.16; 'received:rangi.cloud': 0.16; 'sorted':
0.16; 'subject:Newline': 0.16; 'url-ip:66.96/16': 0.16; 'url-
ip:66/8': 0.16; 'wrote:': 0.16; 'libraries': 0.19;
'subject:Question': 0.19; 'to:addr:python-list': 0.20; "i've":
0.22; 'code': 0.23; 'url:wiki': 0.23; 'student': 0.24; 'examples':
0.25; '>>>': 0.28; 'chris': 0.28; 'header:User-Agent:1': 0.30;
'am,': 0.31; 'program': 0.31; 'think': 0.32; 'expand': 0.32;
'maintaining': 0.32; 'python-list': 0.32; 'structure': 0.32;
'there': 0.33; "didn't": 0.34; 'printing': 0.34; 'header:In-Reply-
To:1': 0.34; 'item': 0.35; 'url:)': 0.35; 'lists': 0.37; 'others':
0.37; 'received:192.168': 0.37; 'though': 0.37; 'students': 0.38;
'list': 0.39; 'something': 0.40; 'want': 0.40; 'michael': 0.60;
"there's": 0.61; 'me.': 0.62; 'seen': 0.62; 'email
addr:gmail.com': 0.63; 'pass': 0.64; 'she': 0.64; 'full': 0.64;
'received:51': 0.64; 'look': 0.65; 'less': 0.65; 'url:wikipedia':
0.70; 'little': 0.73; 'happens': 0.84; 'reasons': 0.84; 'cum':
0.84; 'selects': 0.84; 'mind,': 0.93
DKIM-Filter: OpenDKIM Filter v2.11.0 vps.rangi.cloud E6B0423E6
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=danceswithmice.info;
s=staff; t=1701035892;
bh=6VlW/wp+wKPLm3t7Kyfc/qs/szUX5v/hOc9ImME5kCo=;
h=Date:Subject:To:References:From:In-Reply-To:From;
b=C5IMOHAtqqttVtUCeZiHuzWOmzWQVPEE9EARhM3Ru6EnVVlzrQvtFmNFLFQ95QcY3
JnbiiM3KB1vZaiArJj6z49UQ/wgKwsYJzDScdoG+EShOfgoys+a0EgxDyOYHuQuzku
WdgjbnO0erskmJs/Tpd7EHcnZPii1A4eT67mBcvHZ9JzkB+6C3RWSwlROHDbrJ1E1U
9y9zm+vWMhXZ1qI9OYMaMnA6naQMnJkB6x7witryAXcMYHW/9lsw1fDGIayhFwbpFQ
Ee9Fbt28zaU+YrPPNDUadbFoEKSijY+Halz1/vvcDDcYzw9lfiXMTZ3VrjwbNeSDfC
hzwt06sp2r9Ug==
User-Agent: Mozilla Thunderbird
Content-Language: en-US
In-Reply-To: <CAPTjJmo2cZjPvC8_=0vbQAyhA4t5LS-c=QCekZqmpWogxCJo6Q@mail.gmail.com>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <765911b5-b673-4d3b-b7e4-3bd0ea94bf3d@danceswithmice.info>
X-Mailman-Original-References: <65547270.3139.338043@RealGrizzlyAdams.vivaldi.net>
<6555B48F.10108.156EC1@RealGrizzlyAdams.vivaldi.net>
<4626640f-4fe5-49bc-a6f8-d555b7f7b58a@tompassin.net>
<65561BDA.14413.9EACE9@RealGrizzlyAdams.vivaldi.net>
<016601da1f51$e4e84410$aeb8cc30$@gmail.com>
<mailman.289.1700883959.3828.python-list@python.org>
<ujt0i2$2r3tf$1@dont-email.me>
<CAPTjJmo2cZjPvC8_=0vbQAyhA4t5LS-c=QCekZqmpWogxCJo6Q@mail.gmail.com>
 by: DL Neil - Sun, 26 Nov 2023 21:58 UTC

On 11/27/2023 12:48 AM, Chris Angelico via Python-list wrote:
> On Sun, 26 Nov 2023 at 21:08, Michael F. Stemper via Python-list
> <python-list@python.org> wrote:
>>
>> On 24/11/2023 21.45, avi.e.gross@gmail.com wrote:
>>> Grizz[l]y,
>>>
>>> I think the point is not about a sorted list or sorting in general It is
>>> about reasons why maintaining a data structure such as a list in a program
>>> can be useful beyond printing things once. There are many possible examples
>>> such as having a list of lists containing a record where the third item is a
>>> GPA for the student and writing a little list comprehension that selects a
>>> smaller list containing only students who are Magna Cum Laude or Summa Cum
>>> Laude.
>>>
>>> studs = [
>>> ["Peter", 82, 3.53],
>>> ["Paul", 77, 2.83],
>>> ["Mary", 103, 3.82]
>>> ]
>>
>> I've seen Mary, and she didn't look like a "stud" to me.
>>
>
> That's what happens when you abbreviate "student" though :) Don't
> worry, there's far FAR worse around the place, and juvenile brains
> will always find things to snigger at, usually in mathematical
> libraries with "cumulative" functions.

The OP used an abbreviation: "studs". Why? Too lazy to type the full
word? Abbreviation has full-meaning in the (narrow) domain? Was wanting
something funny, or to snigger over?

Was the respondent sniggering? Perhaps he, like the OP, was also saving
typing-time by making a joke, hoping that the OP would see the
implicit-error in expecting others to understand that "studs" meant
"students"?

Actually, Peter, Paul, and Mary were a band
(https://www.peterpaulandmary.com/), so "studs" is even less expressive
when the data also tells a story...

Working with "trainees", I avoid the word "student" even though some
might see them as synonyms. In my mind, the abbreviation did not readily
expand to the full word (mea culpa).

Accordingly, would not pass Code Review!
For the want of a few characters...
(https://en.wikipedia.org/wiki/For_Want_of_a_Nail)

--
Regards =dn

Re: RE: Newline (NuBe Question)

<mailman.301.1701035916.3828.python-list@python.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=28962&group=comp.lang.python#28962

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: rosuav@gmail.com (Chris Angelico)
Newsgroups: comp.lang.python
Subject: Re: RE: Newline (NuBe Question)
Date: Mon, 27 Nov 2023 08:58:21 +1100
Lines: 12
Message-ID: <mailman.301.1701035916.3828.python-list@python.org>
References: <65547270.3139.338043@RealGrizzlyAdams.vivaldi.net>
<6555B48F.10108.156EC1@RealGrizzlyAdams.vivaldi.net>
<4626640f-4fe5-49bc-a6f8-d555b7f7b58a@tompassin.net>
<65561BDA.14413.9EACE9@RealGrizzlyAdams.vivaldi.net>
<016601da1f51$e4e84410$aeb8cc30$@gmail.com>
<mailman.289.1700883959.3828.python-list@python.org>
<ujt0i2$2r3tf$1@dont-email.me>
<CAPTjJmo2cZjPvC8_=0vbQAyhA4t5LS-c=QCekZqmpWogxCJo6Q@mail.gmail.com>
<005201da209c$e1bb0c90$a53125b0$@gmail.com>
<CAPTjJmovZMJUvzd+Tv5Mcw=fdM1g-ohoYNT5Lzj19vGFsWFZag@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: news.uni-berlin.de qK7ItstJAFUZGHIo4QRPEA9/ZMySU24y8fYQ4ta88ASg==
Cancel-Lock: sha1:bvUsbW5NW9Y+IuW6bUE/9NyuIr8= sha256:azL5a/48uiO/lhc/L8ip6u1gb2K3HcSgeTUp+8RHOoQ=
Return-Path: <rosuav@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=lp/PM+pP;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.020
X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'variable': 0.05; '2023':
0.07; '...]': 0.16; 'chrisa': 0.16; 'drive,': 0.16;
'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16;
'subject:Newline': 0.16; 'wrote:': 0.16; 'subject:Question': 0.19;
'to:addr:python-list': 0.20; 'do?': 0.26; 'program': 0.31;
'message-id:@mail.gmail.com': 0.32; 'but': 0.32; 'header:In-Reply-
To:1': 0.34; 'received:google.com': 0.34; 'from:addr:gmail.com':
0.35; 'mon,': 0.36; 'students': 0.38; 'happen': 0.40; 'learn':
0.40; 'ever': 0.63; 'feel': 0.63; 'complete': 0.64; 'received
:mail-lj1-x22d.google.com': 0.69
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1701035913; x=1701640713; darn=python.org;
h=to:subject:message-id:date:from:in-reply-to:references:mime-version
:from:to:cc:subject:date:message-id:reply-to;
bh=pHo8zgbIQh5ODmhQRHCvNp1JQ96VJNcGaz3RzfRgE0Y=;
b=lp/PM+pPNTeHrkrJorZWz7EvoT7m6rgObmNQqnO5c0o7XJz6sAP3K26WLOCAF8ex/5
gLmp4vywlN7ahIUiAzURcKLRd3H25SfcVN+ryYtgBxOP4YVUnsiWocbZVtc0dasALo9C
PaIPaFWhgL2VjVXvDlatkoshFiyp/ibVxKbM2NoCY2grqLNUA0fxVJfGwmkTeJ+va25v
uH+Erxj16a67TUbNMkIL4h8Ry+N0YxEeAmj9llGHhqZdGF/ZJET4dsoynGMS6iZwtHov
T96uCA811Q2Uh3H3wozRQ1E5HWzV/1lmWnoBng1WX9/GAlagrJmnTPCo9u0Cea2brw3G
EG0Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1701035913; x=1701640713;
h=to:subject:message-id:date:from:in-reply-to:references:mime-version
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=pHo8zgbIQh5ODmhQRHCvNp1JQ96VJNcGaz3RzfRgE0Y=;
b=h19l8+zsaidaeCJnYG4+W6fAx4Z4vLvx3xzgoL3/iI5w/hGOj8kaWYZbaj41Oe+Tc+
vbyZtRutAwDbZ1nso6qAuZ/AONy8sx/m+Z3S6tMgSmSkHp7BPbESnt31zFIWpMZvbEon
TdsfbxuwyblSq08vtRgGqJvnsW8hVjIXEPYR1BYNJPNUNUuTvAzPHa7xTotf1OQ3t/vn
ofwiglSJn0/XJrAqE4g1pGrOA3IUtDGaOHSyVUD5hrGRl0EjRSyYoKpvc+QzD7G9y3PP
FTm5OAn60G+tIQW7+r7UnHRDUCxCkDTJsGQH/BEKKZbruR5DscJeMn9WzDerWb2aTGma
W45w==
X-Gm-Message-State: AOJu0YxTknDvQ/3HwspQYMscjUa1bVp5sfFFPKPdqJdkZ37e+DlmTNaq
LQk5jH0gXg69melHXwyChtaRRwgRz4n4ZZxloluSq57c
X-Google-Smtp-Source: AGHT+IH/5vHsBdkf374XHWQwUiCZ580fnvQ/47kPUryZGCQFzSC3I9RuQ1IwZCBLH8TK/5pHpx+ZRO0/D8hESdWHjfI=
X-Received: by 2002:a2e:90d5:0:b0:2c5:18ed:1809 with SMTP id
o21-20020a2e90d5000000b002c518ed1809mr5836426ljg.34.1701035912859; Sun, 26
Nov 2023 13:58:32 -0800 (PST)
In-Reply-To: <005201da209c$e1bb0c90$a53125b0$@gmail.com>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <CAPTjJmovZMJUvzd+Tv5Mcw=fdM1g-ohoYNT5Lzj19vGFsWFZag@mail.gmail.com>
X-Mailman-Original-References: <65547270.3139.338043@RealGrizzlyAdams.vivaldi.net>
<6555B48F.10108.156EC1@RealGrizzlyAdams.vivaldi.net>
<4626640f-4fe5-49bc-a6f8-d555b7f7b58a@tompassin.net>
<65561BDA.14413.9EACE9@RealGrizzlyAdams.vivaldi.net>
<016601da1f51$e4e84410$aeb8cc30$@gmail.com>
<mailman.289.1700883959.3828.python-list@python.org>
<ujt0i2$2r3tf$1@dont-email.me>
<CAPTjJmo2cZjPvC8_=0vbQAyhA4t5LS-c=QCekZqmpWogxCJo6Q@mail.gmail.com>
<005201da209c$e1bb0c90$a53125b0$@gmail.com>
 by: Chris Angelico - Sun, 26 Nov 2023 21:58 UTC

On Mon, 27 Nov 2023 at 06:15, <avi.e.gross@gmail.com> wrote:
> But I learn from criticism. If I ever write a program like that and do not
> feel like typing, will this do?
>
> dents = [ ...]
>
> Or will that not include students who happen to be edentulous?
>

If they're learning to drive, this variable name would make complete sense.

ChrisA

Re: Newline (NuBe Question)

<mailman.302.1701036123.3828.python-list@python.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=28963&group=comp.lang.python#28963

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: PythonList@danceswithmice.info (DL Neil)
Newsgroups: comp.lang.python
Subject: Re: Newline (NuBe Question)
Date: Mon, 27 Nov 2023 11:01:51 +1300
Lines: 11
Message-ID: <mailman.302.1701036123.3828.python-list@python.org>
References: <65547270.3139.338043@RealGrizzlyAdams.vivaldi.net>
<6555B48F.10108.156EC1@RealGrizzlyAdams.vivaldi.net>
<4626640f-4fe5-49bc-a6f8-d555b7f7b58a@tompassin.net>
<65561BDA.14413.9EACE9@RealGrizzlyAdams.vivaldi.net>
<016601da1f51$e4e84410$aeb8cc30$@gmail.com>
<mailman.289.1700883959.3828.python-list@python.org>
<ujt0i2$2r3tf$1@dont-email.me>
<9971c210-f777-41ea-b3b8-a3a429c65882@roelschroeven.net>
<b436a160-e9be-4b0b-b222-67ea4bd1df82@danceswithmice.info>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de /t9h5LdJhmcn25/EisjV9gBWac5W4bBlUyDJUfraaKOw==
Cancel-Lock: sha1:bChCjYM9hVRwwYL7yemoJU7SWlA= sha256:B/mscC7Nv7sAOxWYxYPB9sFzBq5WyZ1H77bPQyzhCDs=
Return-Path: <PythonList@danceswithmice.info>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=danceswithmice.info header.i=@danceswithmice.info
header.b=ao6DFwUa; dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.001
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'field.': 0.07; '=dn':
0.09; 'from:addr:danceswithmice.info': 0.09;
'from:addr:pythonlist': 0.09; 'from:name:dl neil': 0.09; 'roel':
0.09; 'schroeven': 0.09; 'index:': 0.16; 'received:cloud': 0.16;
'received:rangi.cloud': 0.16; 'subject:Newline': 0.16; 'tuples.':
0.16; 'wrote:': 0.16; 'instead': 0.17; 'subject:Question': 0.19;
'to:addr:python-list': 0.20; 'wrong': 0.28; 'header:User-Agent:1':
0.30; 'am,': 0.31; 'python-list': 0.32; 'header:In-Reply-To:1':
0.34; 'received:192.168': 0.37; 'likely': 0.61; 'skip:r 20': 0.64;
'less': 0.65
DKIM-Filter: OpenDKIM Filter v2.11.0 vps.rangi.cloud 00B683002
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=danceswithmice.info;
s=staff; t=1701036115;
bh=mhq2EH9AjIpc9Fb4ZftivZZKc4j0np4K013PbYtwPYc=;
h=Date:Subject:To:References:From:In-Reply-To:From;
b=ao6DFwUa4vgw1WFfvHjQjjEH/fazfFbZyM2t0N4IhH5Cba0hYBgDCpS4L4+ZEESER
Gkbk+OiUUNlhBKVBkh9P5w7AtGNVONs2ujJkkW/+CU7VXkOwLFJd5xeFhBjKRj0umC
o3UBxAgOTfgyrBbcQk/Q2heBBKAtB6HjL46lEQL4oFFFFGQ/YaaBnoPu74f1GEYgGo
qKiZGMKc7S4x40oRV/AcNrn0JWQePvb0Ko3aj39kDafdYwOSMw64fRGLOZYxzVcjdO
IAhk55GwpTl1c+/kZ6O+ngwTnUfBCKu97EC31wn66IV2taktC8T1FJxMhe5m45tiWV
9yvY0684aa/AA==
User-Agent: Mozilla Thunderbird
Content-Language: en-US
In-Reply-To: <9971c210-f777-41ea-b3b8-a3a429c65882@roelschroeven.net>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <b436a160-e9be-4b0b-b222-67ea4bd1df82@danceswithmice.info>
X-Mailman-Original-References: <65547270.3139.338043@RealGrizzlyAdams.vivaldi.net>
<6555B48F.10108.156EC1@RealGrizzlyAdams.vivaldi.net>
<4626640f-4fe5-49bc-a6f8-d555b7f7b58a@tompassin.net>
<65561BDA.14413.9EACE9@RealGrizzlyAdams.vivaldi.net>
<016601da1f51$e4e84410$aeb8cc30$@gmail.com>
<mailman.289.1700883959.3828.python-list@python.org>
<ujt0i2$2r3tf$1@dont-email.me>
<9971c210-f777-41ea-b3b8-a3a429c65882@roelschroeven.net>
 by: DL Neil - Sun, 26 Nov 2023 22:01 UTC

On 11/27/2023 1:08 AM, Roel Schroeven via Python-list wrote:
> I prefer namedtuples or dataclasses over tuples. They allow you to refer
> to their fields by name instead of index: student.gpa is much clearer
> than student[2], and makes it less likely to accidentally refer to the
> wrong field.

+1
readability/comprehension!

--
Regards =dn

Re: Newline (NuBe Question)

<mailman.303.1701037175.3828.python-list@python.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=28964&group=comp.lang.python#28964

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: PythonList@danceswithmice.info (DL Neil)
Newsgroups: comp.lang.python
Subject: Re: Newline (NuBe Question)
Date: Mon, 27 Nov 2023 11:19:28 +1300
Lines: 56
Message-ID: <mailman.303.1701037175.3828.python-list@python.org>
References: <65547270.3139.338043@RealGrizzlyAdams.vivaldi.net>
<6555B48F.10108.156EC1@RealGrizzlyAdams.vivaldi.net>
<4626640f-4fe5-49bc-a6f8-d555b7f7b58a@tompassin.net>
<65561BDA.14413.9EACE9@RealGrizzlyAdams.vivaldi.net>
<016601da1f51$e4e84410$aeb8cc30$@gmail.com>
<mailman.289.1700883959.3828.python-list@python.org>
<ujt0i2$2r3tf$1@dont-email.me> <20231126210409.wbcdjkuxmwh7l23q@hjp.at>
<91044403-9584-4161-a490-7cac3d8310a7@danceswithmice.info>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de A7bPL/whpzDQlk3UuJPXPg6QeQIuyR9MUGDdf10qpOEA==
Cancel-Lock: sha1:1vMD9GqLT4f2dsu2rFEdJhlD/1s= sha256:iV1f4kVXB8UNJOLApKWpYPtx0uvBb3FjBhbbKdx4NcA=
Return-Path: <PythonList@danceswithmice.info>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=danceswithmice.info header.i=@danceswithmice.info
header.b=fd0cyrFA; dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.074
X-Spam-Evidence: '*H*': 0.85; '*S*': 0.00; 'coder': 0.07; 'guido':
0.07; 'modules': 0.07; '=dn': 0.09;
'from:addr:danceswithmice.info': 0.09; 'from:addr:pythonlist':
0.09; 'from:name:dl neil': 0.09; 'objects,': 0.09; 'skip:^ 10':
0.09; 'holzer': 0.16; 'objects.': 0.16; 'offer...': 0.16; 'oop':
0.16; 'received:51.254': 0.16; 'received:51.254.211': 0.16;
'received:51.254.211.219': 0.16; 'received:cloud': 0.16;
'received:rangi.cloud': 0.16; 'sadly,': 0.16; 'step.': 0.16;
'structures': 0.16; 'subject:Newline': 0.16; 'tuples': 0.16;
'whilst': 0.16; 'wrote:': 0.16; 'problem': 0.16; 'python': 0.16;
'subject:Question': 0.19; 'to:addr:python-list': 0.20; 'language':
0.21; "i've": 0.22; 'code': 0.23; '>>>': 0.28; 'goes': 0.28;
'suggest': 0.28; 'header:User-Agent:1': 0.30; 'am,': 0.31;
'approach': 0.31; 'context': 0.32; 'objects': 0.32; 'python-list':
0.32; 'structure': 0.32; "wouldn't": 0.32; 'but': 0.32;
'particular': 0.33; 'header:In-Reply-To:1': 0.34; '"if': 0.35;
'work,': 0.36; 'change': 0.36; 'those': 0.36; 'lists': 0.37;
'using': 0.37; 'received:192.168': 0.37; 'could': 0.38; 'two':
0.39; 'single': 0.39; 'list': 0.39; 'courses': 0.39; 'data.':
0.40; 'serious': 0.40; 'michael': 0.60; 'included': 0.61; 'skip:o
10': 0.61; 'here': 0.62; 'email addr:gmail.com': 0.63; 'between':
0.63; 'skip:b 10': 0.63; 'key': 0.64; 'research': 0.64; 'becomes':
0.64; 'received:51': 0.64; 'thus': 0.64; 'his': 0.65; 'came':
0.65; 'process.': 0.65; 'look': 0.65; 'effort,': 0.69; 'etc,':
0.69; 'latter': 0.69; 'speed': 0.71; 'skip:* 10': 0.71;
'process,': 0.75; 'conducting': 0.76; 'mr.': 0.78; 'publish':
0.84; 'concerns.': 0.84; 'resistant': 0.84; 'said:': 0.84;
'time!': 0.84; "world'": 0.84; 'are...': 0.91; 'avoiding': 0.91;
'loses': 0.91; 'reveals': 0.91; 'former': 0.93
DKIM-Filter: OpenDKIM Filter v2.11.0 vps.rangi.cloud 306FD35AD
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=danceswithmice.info;
s=staff; t=1701037172;
bh=2d9Givdsm8kgq8h9O892ZV1/ytAkBREnBQ+wjpiiHEY=;
h=Date:Subject:To:References:From:In-Reply-To:From;
b=fd0cyrFAyTqej0LI/7OOedobFLd2QNLtxOvndKuuG4bksnuQA8uLhPaNWnHOGIYg9
HBFQaQ8DSezF7BU7w4SXBy54r+UQV6sNpmAaFHOmf/WlG67rZLo3B3ttJmiT0jJfek
ffRFbA0Qmpk/Fpjm+9wlRWX3G7vcSusiNVKXyEgyeIPT8YYAahbRhEfoB/IyoDg4eT
JTEdhMpw9GvBPMXrN2hv3zKUZT9y6J0xdb5JA04LEZlK9vUX/I0W6Qti1EHmhY4KIH
Ucapp3IEbXOPtuwL6KiADnObZmcqZ3MMhWgtWs/VnmUM8iS2b/rA/EkVjRwZYNN5uX
vb1xQkjdJHtcQ==
User-Agent: Mozilla Thunderbird
Content-Language: en-US
In-Reply-To: <20231126210409.wbcdjkuxmwh7l23q@hjp.at>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <91044403-9584-4161-a490-7cac3d8310a7@danceswithmice.info>
X-Mailman-Original-References: <65547270.3139.338043@RealGrizzlyAdams.vivaldi.net>
<6555B48F.10108.156EC1@RealGrizzlyAdams.vivaldi.net>
<4626640f-4fe5-49bc-a6f8-d555b7f7b58a@tompassin.net>
<65561BDA.14413.9EACE9@RealGrizzlyAdams.vivaldi.net>
<016601da1f51$e4e84410$aeb8cc30$@gmail.com>
<mailman.289.1700883959.3828.python-list@python.org>
<ujt0i2$2r3tf$1@dont-email.me> <20231126210409.wbcdjkuxmwh7l23q@hjp.at>
 by: DL Neil - Sun, 26 Nov 2023 22:19 UTC

On 11/27/2023 10:04 AM, Peter J. Holzer via Python-list wrote:
> On 2023-11-25 08:32:24 -0600, Michael F. Stemper via Python-list wrote:
>> On 24/11/2023 21.45, avi.e.gross@gmail.com wrote:
>>> Of course, for serious work, some might suggest avoiding constructs like a
>>> list of lists and switch to using modules and data structures [...]
>>
>> Those who would recommend that approach do not appear to include Mr.
>> Rossum, who said:
>> Avoid overengineering data structures.
> ^^^^^^^^^^^^^^^
>
> The key point here is *over*engineering. Don't make things more
> complicated than they need to be. But also don't make them simpler than
> necessary.
>
>> Tuples are better than objects (try namedtuple too though).
>
> If Guido thought that tuples would always be better than objects, then
> Python wouldn't have objects. Why would he add such a complicated
> feature to the language if he thought it was useless?
>
> The (unspoken?) context here is "if tuples are sufficient, then ..."

At recent PUG-meetings I've listened to a colleague asking questions and
conducting research on Python data-structures*, eg lists-of-lists cf
lists-of-tuples, etc, etc. The "etc, etc" goes on for some time!
Respecting the effort, even as it becomes boringly-detailed, am
encouraging him to publish his findings.

* sadly, he is resistant to OOP and included only a cursory look at
custom-objects, and early in the process. His 'new thinking' has been to
look at in-core databases and the speed-ups SQL (or other) might offer...

However, his motivation came from a particular application, and to
create a naming-system so that he could distinguish a list-of-lists
structure from some other tabular abstraction. The latter enables the
code to change data-format to speed the next process, without the coder
losing-track of the data-type/format.

The trouble is, whereas the research reveals which is faster
(in-isolation, and (only) on his 'platform'), my suspicion is that he
loses all gains by reformatting the data between 'the most efficient'
structure for each step. A problem of only looking at the 'micro',
whilst ignoring wider/macro concerns.

Accordingly, as to the word "engineering" (above), a reminder that we
work in two domains: code and data. The short 'toy examples' in training
courses discourage us from a design-stage for the former - until we
enter 'the real world' and meet a problem/solution too large to fit in a
single human-brain. Sadly, too many of us are pre-disposed to be
math/algorithmically-oriented, and thus data-design is rarely-considered
(in the macro!). Yet, here we are...

--
Regards =dn

RE: Newline (NuBe Question)

<mailman.304.1701053460.3828.python-list@python.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=28965&group=comp.lang.python#28965

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: <avi.e.gross@gmail.com>
Newsgroups: comp.lang.python
Subject: RE: Newline (NuBe Question)
Date: Sun, 26 Nov 2023 21:50:54 -0500
Lines: 91
Message-ID: <mailman.304.1701053460.3828.python-list@python.org>
References: <65547270.3139.338043@RealGrizzlyAdams.vivaldi.net>
<6555B48F.10108.156EC1@RealGrizzlyAdams.vivaldi.net>
<4626640f-4fe5-49bc-a6f8-d555b7f7b58a@tompassin.net>
<65561BDA.14413.9EACE9@RealGrizzlyAdams.vivaldi.net>
<016601da1f51$e4e84410$aeb8cc30$@gmail.com>
<mailman.289.1700883959.3828.python-list@python.org>
<ujt0i2$2r3tf$1@dont-email.me>
<CAPTjJmo2cZjPvC8_=0vbQAyhA4t5LS-c=QCekZqmpWogxCJo6Q@mail.gmail.com>
<765911b5-b673-4d3b-b7e4-3bd0ea94bf3d@danceswithmice.info>
<008701da20dc$8a869260$9f93b720$@gmail.com>
Mime-Version: 1.0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de lgO6vj77IjF1uy7IdzjfLwLLh0xTdejc3zcRd8i1dGGQ==
Cancel-Lock: sha1:Y6+FbQrj80L9FNNr3ijjBpvr+xM= sha256:JWiXBTZYTtEYX1b51j8UU/o1OH+NYTNVPB2SIb6jVpA=
Return-Path: <avi.e.gross@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=DYnGh1Wu;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.015
X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'this:': 0.03;
'containing': 0.05; '2023': 0.07; '26,': 0.07; 'sun,': 0.07;
'wanting': 0.07; '=dn': 0.09; 'analyzed': 0.09; 'angelico': 0.09;
'lazy': 0.09; 'meant': 0.09; 'neil': 0.09; 'received:108': 0.09;
'smaller': 0.09; 'url:mailman': 0.15; 'domain?': 0.16; 'examine':
0.16; 'expected.': 0.16; 'fascinating': 0.16; 'functions.': 0.16;
'funny,': 0.16; 'history,': 0.16; 'language?': 0.16; 'latin.':
0.16; 'mary': 0.16; 'mathematical': 0.16; 'newline': 0.16;
'news.': 0.16; 'once.': 0.16; 'over?': 0.16; 'sorted': 0.16;
'subject:Newline': 0.16; 'url-ip:66.96/16': 0.16; 'url-ip:66/8':
0.16; 'wrote:': 0.16; 'message-id:@gmail.com': 0.18; 'libraries':
0.19; 'subject:Question': 0.19; 'to:addr:python-list': 0.20;
"i've": 0.22; 'code': 0.23; 'url:wiki': 0.23; 'student': 0.24;
'skip:- 10': 0.25; 'url-ip:188.166.95.178/32': 0.25; 'url-
ip:188.166.95/24': 0.25; 'examples': 0.25; 'url:listinfo': 0.25;
'url-ip:188.166/16': 0.25; "isn't": 0.27; '>>>': 0.28; 'chris':
0.28; 'computer': 0.29; 'am,': 0.31; 'url-ip:188/8': 0.31;
'program': 0.31; 'think': 0.32; 'expand': 0.32; 'maintaining':
0.32; 'python-list': 0.32; 'structure': 0.32; 'topic,': 0.32;
'unless': 0.32; 'but': 0.32; 'there': 0.33; "didn't": 0.34;
'printing': 0.34; 'header:In-Reply-To:1': 0.34;
'received:google.com': 0.34; 'item': 0.35; 'meaning': 0.35;
'url:)': 0.35; 'yes,': 0.35; 'from:addr:gmail.com': 0.35; 'work,':
0.36; 'lists': 0.37; 'special': 0.37; 'really': 0.37; 'using':
0.37; 'others': 0.37; 'though': 0.37; 'students': 0.38; 'list':
0.39; 'use': 0.39; 'scheduled': 0.39; 'something': 0.40; 'want':
0.40; 'michael': 0.60; 'popular': 0.60; "there's": 0.61; 'from:':
0.62; 'me.': 0.62; 'to:': 0.62; 'seen': 0.62; 'ever': 0.63; 'email
addr:gmail.com': 0.63; 'once': 0.63; 'pass': 0.64; 'she': 0.64;
'our': 0.64; 'full': 0.64; 're:': 0.64; 'came': 0.65; 'look':
0.65; 'less': 0.65; 'numbers': 0.67; 'back': 0.67; 'latin': 0.69;
'malicious': 0.69; 'piece': 0.69; 'interest': 0.70; 'url-
ip:208.80/16': 0.70; 'url:wikipedia': 0.70; 'url-ip:208/8': 0.71;
'offer': 0.71; 'future': 0.72; 'little': 0.73; 'choice': 0.76;
'sent:': 0.78; 'paul': 0.81; 'happens': 0.84; 'reasons': 0.84;
'characters': 0.84; 'cum': 0.84; 'selects': 0.84; 'subtle': 0.84;
'testament': 0.91; 'p.s.': 0.92; 'aspects': 0.93; 'mind,': 0.93
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1701053456; x=1701658256; darn=python.org;
h=thread-index:content-language:content-transfer-encoding
:mime-version:message-id:date:subject:in-reply-to:references:to:from
:from:to:cc:subject:date:message-id:reply-to;
bh=NLoffHZKTChhHyZTCumzL7N8kAcSLEr6M7WAwgtoP2A=;
b=DYnGh1WuweJPBx+tGoUqf03gdCP2YYPnrWLXgHYbGVoFIGMohx72ZydywjTTQ3SX9W
iGo/VSy7GYvtVxFXbv21bzLEIE1mxkDD14M40QLQypEv5UQ1h73QapYNCH6v450AaFym
nr6fl5eod+FYJje0yXwbfb7On+zWNZZ0PTCgUK0VrdnJJs3I6mAhYexIDRt/3BeXKTXH
CsgPopYte8xTKr7DPef8NKgqxEHvOWp+YVObs8p9/I7NKfLvGvkg38p97ol3OcuyGaUW
7ZNnr/yV987lXyIRWngxihpCyJ4o1DyDn1ifcd8hxvuv1OTg7fJ6IGOqpKHiJgFNQwJf
7BDA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1701053456; x=1701658256;
h=thread-index:content-language:content-transfer-encoding
:mime-version:message-id:date:subject:in-reply-to:references:to:from
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=NLoffHZKTChhHyZTCumzL7N8kAcSLEr6M7WAwgtoP2A=;
b=WBZmjAdapWuTV46n0iAgF7pdcy9GsnKnIUtPoCfH8IsJihJgJzwoI/SZOmizFVFKRk
GwpLW3EExC5cLvwWMMrTEwilfr6g+6Ib8+R5GC6IcJXw0MGs6WdW6tXISTjeLOLKNpag
9SWYXPi5DwEkBf/40Rxt2YFmMbC0WsSF0x6z4Oir3D4gHZ2CkA+G/85LfRzE2a1oPtaw
/zPCMDd8uCQsnnS7e9I3ThJgBMlcM4zVhB9maLnEopCBLBYYub+dVdn2t7+n++gOcZGp
vgiL05pBRA37Gmqp0IWcHOuwf9FVkyvlw37FjSeSm2GaFs9mYYmx+dYqA4JMYId9Kd32
Lwlw==
X-Gm-Message-State: AOJu0YyZYVcgMeVEcbXO6raLQB1qlr7P47AvGmOdyUa1NLkMS6C9/Hxd
xt9Sjtye9ksHdegPFJsJg34=
X-Google-Smtp-Source: AGHT+IGnrjL4LnluMt6abdXc2mChNLu4i3GF9GVC/jnBwS5i3oMAgKS7fhkRZ6byKdZYcpELqZgmXA==
X-Received: by 2002:a05:622a:1e8d:b0:423:9b3d:efbd with SMTP id
bz13-20020a05622a1e8d00b004239b3defbdmr14158366qtb.18.1701053456531;
Sun, 26 Nov 2023 18:50:56 -0800 (PST)
In-Reply-To: <765911b5-b673-4d3b-b7e4-3bd0ea94bf3d@danceswithmice.info>
X-Mailer: Microsoft Outlook 16.0
Content-Language: en-us
Thread-Index: AQLE5XCijAbYn+n7sN9UKc2YtIQx7wCvRdtIAgiVzWYCiv+1DAItEPQ6Aq35/mwBgwsbAAJH5KpPAda7VPmuOe7D4A==
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <008701da20dc$8a869260$9f93b720$@gmail.com>
X-Mailman-Original-References: <65547270.3139.338043@RealGrizzlyAdams.vivaldi.net>
<6555B48F.10108.156EC1@RealGrizzlyAdams.vivaldi.net>
<4626640f-4fe5-49bc-a6f8-d555b7f7b58a@tompassin.net>
<65561BDA.14413.9EACE9@RealGrizzlyAdams.vivaldi.net>
<016601da1f51$e4e84410$aeb8cc30$@gmail.com>
<mailman.289.1700883959.3828.python-list@python.org>
<ujt0i2$2r3tf$1@dont-email.me>
<CAPTjJmo2cZjPvC8_=0vbQAyhA4t5LS-c=QCekZqmpWogxCJo6Q@mail.gmail.com>
<765911b5-b673-4d3b-b7e4-3bd0ea94bf3d@danceswithmice.info>
 by: <avi.e.gross@gmail.com> - Mon, 27 Nov 2023 02:50 UTC

Isn't it fascinating that a meaningless piece of code used to illustrate
something can be analyzed as if it was full of malicious content?

Yes, my choice of names was as expected. The numbers chosen had no special
meaning other than choosing one number in each of three equivalence classes.

But, if you want me to add subtle meaning for generations to examine as it
it were a literary work, I offer this:

Peter and Paul were studs who got Mary'd.

Can we now go back to our regularly scheduled talking about aspects of a
computer language?

P.S.
And just for history, Paul was really Noel Paul Stookey but Peter, Paul &
Mary sounded more like new testament characters and I think Noel signifies a
birth to Peter and Mary, sort of, which might have fit too unless it was a
computer program where a name with an umlaut was once not common. Another
interpretation is that Noel came from the Latin word for news. Be that as it
may, and I have no interest in this topic, in the future I may use the ever
popular names of Primus, Secundus and Tertius and get blamed for using
Latin.

-----Original Message-----
From: Python-list <python-list-bounces+avi.e.gross=gmail.com@python.org> On
Behalf Of DL Neil via Python-list
Sent: Sunday, November 26, 2023 4:58 PM
To: python-list@python.org
Subject: Re: Newline (NuBe Question)

On 11/27/2023 12:48 AM, Chris Angelico via Python-list wrote:
> On Sun, 26 Nov 2023 at 21:08, Michael F. Stemper via Python-list
> <python-list@python.org> wrote:
>>
>> On 24/11/2023 21.45, avi.e.gross@gmail.com wrote:
>>> Grizz[l]y,
>>>
>>> I think the point is not about a sorted list or sorting in general It is
>>> about reasons why maintaining a data structure such as a list in a
program
>>> can be useful beyond printing things once. There are many possible
examples
>>> such as having a list of lists containing a record where the third item
is a
>>> GPA for the student and writing a little list comprehension that selects
a >>> smaller list containing only students who are Magna Cum Laude or Summa
Cum
>>> Laude.
>>>
>>> studs = [
>>> ["Peter", 82, 3.53],
>>> ["Paul", 77, 2.83],
>>> ["Mary", 103, 3.82]
>>> ]
>>
>> I've seen Mary, and she didn't look like a "stud" to me.
>>
>
> That's what happens when you abbreviate "student" though :) Don't
> worry, there's far FAR worse around the place, and juvenile brains
> will always find things to snigger at, usually in mathematical
> libraries with "cumulative" functions.

The OP used an abbreviation: "studs". Why? Too lazy to type the full
word? Abbreviation has full-meaning in the (narrow) domain? Was wanting
something funny, or to snigger over?

Was the respondent sniggering? Perhaps he, like the OP, was also saving
typing-time by making a joke, hoping that the OP would see the
implicit-error in expecting others to understand that "studs" meant
"students"?

Actually, Peter, Paul, and Mary were a band
(https://www.peterpaulandmary.com/), so "studs" is even less expressive
when the data also tells a story...

Working with "trainees", I avoid the word "student" even though some
might see them as synonyms. In my mind, the abbreviation did not readily
expand to the full word (mea culpa).

Accordingly, would not pass Code Review!
For the want of a few characters...
(https://en.wikipedia.org/wiki/For_Want_of_a_Nail)

--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list

Re: Newline (NuBe Question)

<mailman.305.1701054091.3828.python-list@python.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=28966&group=comp.lang.python#28966

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: rosuav@gmail.com (Chris Angelico)
Newsgroups: comp.lang.python
Subject: Re: Newline (NuBe Question)
Date: Mon, 27 Nov 2023 14:01:17 +1100
Lines: 13
Message-ID: <mailman.305.1701054091.3828.python-list@python.org>
References: <65547270.3139.338043@RealGrizzlyAdams.vivaldi.net>
<6555B48F.10108.156EC1@RealGrizzlyAdams.vivaldi.net>
<4626640f-4fe5-49bc-a6f8-d555b7f7b58a@tompassin.net>
<65561BDA.14413.9EACE9@RealGrizzlyAdams.vivaldi.net>
<016601da1f51$e4e84410$aeb8cc30$@gmail.com>
<mailman.289.1700883959.3828.python-list@python.org>
<ujt0i2$2r3tf$1@dont-email.me>
<CAPTjJmo2cZjPvC8_=0vbQAyhA4t5LS-c=QCekZqmpWogxCJo6Q@mail.gmail.com>
<765911b5-b673-4d3b-b7e4-3bd0ea94bf3d@danceswithmice.info>
<008701da20dc$8a869260$9f93b720$@gmail.com>
<CAPTjJmqOL2kMjv-qigQ4gV23JWeEe5f6brREgSXZT_5AFWm+AA@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: news.uni-berlin.de 77aa8bZYSHGvmCyOMo1HegH4Xv7yHyIBGkZlh+mbXZ8A==
Cancel-Lock: sha1:Dg95g/JKFHIxAPX1puuVY4ZFhJQ= sha256:Ly14aB+G5EiD01X+Ik4Bb2BgD1ty0EeihIar/+HrwGo=
Return-Path: <rosuav@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=jXgOXyom;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.033
X-Spam-Evidence: '*H*': 0.93; '*S*': 0.00; '2023': 0.07; 'avi': 0.16;
'chrisa': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris
angelico': 0.16; 'gross': 0.16; 'latin.': 0.16; 'nonsense': 0.16;
'received:mail-lj1-x233.google.com': 0.16; 'subject:Newline':
0.16; 'wrote:': 0.16; 'subject:Question': 0.19; 'to:addr:python-
list': 0.20; 'python-list': 0.32; 'topic,': 0.32; 'message-
id:@mail.gmail.com': 0.32; 'there': 0.33; 'header:In-Reply-To:1':
0.34; 'received:google.com': 0.34; 'from:addr:gmail.com': 0.35;
'mon,': 0.36; 'using': 0.37; 'use': 0.39; 'popular': 0.60; 'ever':
0.63; 'once': 0.63; 'interest': 0.70; 'future': 0.72; 'hopes':
0.91
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1701054088; x=1701658888; darn=python.org;
h=to:subject:message-id:date:from:in-reply-to:references:mime-version
:from:to:cc:subject:date:message-id:reply-to;
bh=4gyLXX2kQ2Hxx9pl0JPYE8Z/GAgsN5TX0uiaM3rIdgE=;
b=jXgOXyomuCRnQ7KsWhljakS22ulootHrgPJ1+KTDgAaHyTRx19OIlezplO8u2W6sM3
irwWBBE7cBIGZh6npE/0GbRjHcAAR+cnQobVTN5GXG6ZJrXTSpa+mdqU3VzlEPI5TmxF
iSKVuWs2P0DZ87P0pjCz40oSgCGUW+CX/vi0CVNCFckw+1PrVQpXIbByTiUPzIE6Hiqn
+Bl6RKx3RcUGfAe/Qd6J93lCNF/9oXNzk9sJIp0fCazB5uG+d73tDkJOfrS5Pa0Zdi3u
+CPwC6DJ1+VckD5LzwMtPQodFv4jtqqgHXqMLdH3mZHBTgSuCBx4eryoteT0bMKQ0soa
vbhw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1701054088; x=1701658888;
h=to:subject:message-id:date:from:in-reply-to:references:mime-version
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=4gyLXX2kQ2Hxx9pl0JPYE8Z/GAgsN5TX0uiaM3rIdgE=;
b=gcAVoPnM0AgzE7Th34xfgdpbQnM8UbMpOH52xb2Ah+Hoo92KtWbc5HEPvEZmynNB9B
svRetT/1XAhPRE1OlIILBVNvW6jJGkf/rKY49XPZBHCbrUneZ/Yk52xSytJ1KgXrmdmi
J5o1S9vckVKGl+pLWK5OVwn2/ghagl64jyIxcTlRPE34Yt3bpBr4TcKJIDntb+aysxLj
Xyi20TJBiI7qYD5SRYMesUE77H+/PPTyIWwZ/sM+1UN3jOCbrWv7EmzXiGvJ9h6w5QtO
Pt9vLnzNZzJm/bhvtu5GcHNHC23qzPKqFedwCXkgnfk/7wApl39DHX7sOhHAAjUwBfsV
e19A==
X-Gm-Message-State: AOJu0Yz3VjNUYvQCXeUqq+6hmcdC5mW+MbSqlI1kmX2akEFVzDAzj95O
M+7VoHLeLNV0b1iWKr6zTQaqjhkmIGkPJbVCNlzXO5am
X-Google-Smtp-Source: AGHT+IHve8q0bb0BbU6TDZKq5KTUna+dSlP6KEmwxZ90bPhuhpMyD0dTZqCkDFGjHch/YW4kIKBt1QtGLVcDpwZx7Sg=
X-Received: by 2002:a2e:9605:0:b0:2bc:e2bc:81ff with SMTP id
v5-20020a2e9605000000b002bce2bc81ffmr6896315ljh.51.1701054088467; Sun, 26 Nov
2023 19:01:28 -0800 (PST)
In-Reply-To: <008701da20dc$8a869260$9f93b720$@gmail.com>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <CAPTjJmqOL2kMjv-qigQ4gV23JWeEe5f6brREgSXZT_5AFWm+AA@mail.gmail.com>
X-Mailman-Original-References: <65547270.3139.338043@RealGrizzlyAdams.vivaldi.net>
<6555B48F.10108.156EC1@RealGrizzlyAdams.vivaldi.net>
<4626640f-4fe5-49bc-a6f8-d555b7f7b58a@tompassin.net>
<65561BDA.14413.9EACE9@RealGrizzlyAdams.vivaldi.net>
<016601da1f51$e4e84410$aeb8cc30$@gmail.com>
<mailman.289.1700883959.3828.python-list@python.org>
<ujt0i2$2r3tf$1@dont-email.me>
<CAPTjJmo2cZjPvC8_=0vbQAyhA4t5LS-c=QCekZqmpWogxCJo6Q@mail.gmail.com>
<765911b5-b673-4d3b-b7e4-3bd0ea94bf3d@danceswithmice.info>
<008701da20dc$8a869260$9f93b720$@gmail.com>
 by: Chris Angelico - Mon, 27 Nov 2023 03:01 UTC

On Mon, 27 Nov 2023 at 13:52, AVI GROSS via Python-list
<python-list@python.org> wrote:
> Be that as it
> may, and I have no interest in this topic, in the future I may use the ever
> popular names of Primus, Secundus and Tertius and get blamed for using
> Latin.
>

Imperious Prima flashes forth her edict to "begin it". In gentler tone
Secunda hopes there will be nonsense in it. While Tertia interrupts
the tale not more than once a minute.

ChrisA

RE: Newline (NuBe Question)

<mailman.306.1701054939.3828.python-list@python.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=28967&group=comp.lang.python#28967

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: <avi.e.gross@gmail.com>
Newsgroups: comp.lang.python
Subject: RE: Newline (NuBe Question)
Date: Sun, 26 Nov 2023 22:15:35 -0500
Lines: 129
Message-ID: <mailman.306.1701054939.3828.python-list@python.org>
References: <65547270.3139.338043@RealGrizzlyAdams.vivaldi.net>
<6555B48F.10108.156EC1@RealGrizzlyAdams.vivaldi.net>
<4626640f-4fe5-49bc-a6f8-d555b7f7b58a@tompassin.net>
<65561BDA.14413.9EACE9@RealGrizzlyAdams.vivaldi.net>
<016601da1f51$e4e84410$aeb8cc30$@gmail.com>
<mailman.289.1700883959.3828.python-list@python.org>
<ujt0i2$2r3tf$1@dont-email.me> <20231126210409.wbcdjkuxmwh7l23q@hjp.at>
<91044403-9584-4161-a490-7cac3d8310a7@danceswithmice.info>
<008d01da20df$fd06fb60$f714f220$@gmail.com>
Mime-Version: 1.0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de zxHbaUI58jhrycxZvkERIAlR3YOBqqKinQL0VBlFEscw==
Cancel-Lock: sha1:sZHmDKk+PjiJw+vuWRegl+laISU= sha256:xjJdxBSQETjx75o5UGT9pMdkKBoGee25+lYOZ2gAIO0=
Return-Path: <avi.e.gross@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=VWZMofwh;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.010
X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'variable': 0.05; '2023':
0.07; '26,': 0.07; 'coder': 0.07; 'else.': 0.07; 'guido': 0.07;
'hopefully': 0.07; 'modules': 0.07; '=dn': 0.09; 'derived': 0.09;
'insist': 0.09; 'neil': 0.09; 'objects,': 0.09; 'order,': 0.09;
'readable': 0.09; 'received:108': 0.09; 'situations': 0.09;
'skip:^ 10': 0.09; 'url:mailman': 0.15; 'analogy': 0.16;
'chosen,': 0.16; 'columns': 0.16; 'declare': 0.16; 'holzer': 0.16;
'integer': 0.16; 'items,': 0.16; 'iterate': 0.16; 'newline': 0.16;
'objects.': 0.16; 'odd': 0.16; 'offer...': 0.16; 'oop': 0.16;
'programmed': 0.16; 'recall': 0.16; 'sadly,': 0.16; 'specify':
0.16; 'step.': 0.16; 'structures': 0.16; 'subject:Newline': 0.16;
'tuple': 0.16; 'tuples': 0.16; 'ways.': 0.16; 'whilst': 0.16;
'wrote:': 0.16; 'problem': 0.16; 'python': 0.16; 'message-
id:@gmail.com': 0.18; 'subject:Question': 0.19; 'to:addr:python-
list': 0.20; 'language': 0.21; "i've": 0.22; 'languages': 0.22;
'maybe': 0.22; 'code': 0.23; 'header': 0.23; 'run': 0.23; 'idea':
0.24; 'skip:- 10': 0.25; 'url-ip:188.166.95.178/32': 0.25; 'url-
ip:188.166.95/24': 0.25; 'url:listinfo': 0.25; 'cannot': 0.25;
'url-ip:188.166/16': 0.25; 'object': 0.26; 'bit': 0.27; '>>>':
0.28; 'goes': 0.28; 'suggest': 0.28; 'it,': 0.29; 'present': 0.30;
'am,': 0.31; 'approach': 0.31; 'url-ip:188/8': 0.31; 'program':
0.31; 'context': 0.32; 'else,': 0.32; 'empty': 0.32; 'manipulate':
0.32; 'objects': 0.32; 'python-list': 0.32; 'structure': 0.32;
'suitable': 0.32; 'unknown': 0.32; "wouldn't": 0.32; 'but': 0.32;
'there': 0.33; 'hold': 0.33; 'particular': 0.33; 'same': 0.34;
'header:In-Reply-To:1': 0.34; 'received:google.com': 0.34; '"if':
0.35; 'complex': 0.35; 'fine': 0.35; 'from:addr:gmail.com': 0.35;
'number,': 0.64; 're:': 0.64; 'structure,': 0.64; 'thus': 0.64;
'your': 0.64; 'his': 0.65; 'among': 0.65; 'came': 0.65; 'parts':
0.65; 'process.': 0.65; 'similar': 0.65; 'look': 0.65; 'well':
0.65; 'back': 0.67; 'time,': 0.67; 'right': 0.68; 'items': 0.68;
'order': 0.69; 'apply.': 0.69; 'effort,': 0.69; 'etc,': 0.69;
'latter': 0.69; 'order.': 0.69; 'slots': 0.69; 'resulting': 0.70;
'them,': 0.70; 'speed': 0.71; 'care': 0.71; 'longer': 0.71;
'skip:* 10': 0.71; 'deal': 0.73; 'process,': 0.75; 'choice': 0.76;
'conducting': 0.76; 'sent:': 0.78; 'mr.': 0.78; 'happens': 0.84;
'known': 0.84; 'publish': 0.84; 'concerns.': 0.84; 'importantly,':
0.84; 'positioned': 0.84; 'resistant': 0.84; 'said:': 0.84;
'subtle': 0.84; 'time!': 0.84; "world'": 0.84; 'are...': 0.91;
'avoiding': 0.91; 'loses': 0.91; 'reveals': 0.91; 'variation':
0.91; 'aspects': 0.93; 'former': 0.93; 'positions': 0.96
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1701054937; x=1701659737; darn=python.org;
h=thread-index:content-language:content-transfer-encoding
:mime-version:message-id:date:subject:in-reply-to:references:to:from
:from:to:cc:subject:date:message-id:reply-to;
bh=KORJRwHrc+z48gcZo+szFIon4JzThOvDOs6FCz0ExYw=;
b=VWZMofwhBZOXJad0t3k1Fz0Kbuiqll6Bclp2fpNFPJL7ci2IYiQGsbUWtas4FUPhBZ
wxBuI7sqlyf/tJiSmMvSyyyKT4RvKcDQoPu//PNzR0jL93XpMMPrZRcZKaqB9rp0YgoO
k1CBBmZftf3uEp6ryZC+EBzWxPmXRBVAH2KNnzPRXpneohPo98TsAOWDwHHYgO9z+MXW
3QY3B2IYeysczaiYkUP0xfPyCjCOgfssqJLxiMLHBuGQmKTjxlZg1lRb4DVerVS0dBDz
EiPX3aW5iajVvUIfA+Nchykdw5jknnwIuznKzXf/Lxe8U4QbH+zp94rhVjh04lxqI3CC
EjkQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1701054937; x=1701659737;
h=thread-index:content-language:content-transfer-encoding
:mime-version:message-id:date:subject:in-reply-to:references:to:from
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=KORJRwHrc+z48gcZo+szFIon4JzThOvDOs6FCz0ExYw=;
b=ikD1L5qPThdgx967+uFBec1R4k6D14wO6FYWIhT01CaJsljraTGWWTbVmg1choU7mm
o9b2pnFh5OWMxFLZjohUDp5ZQJRmH5ltHH8ay2/k60FBqg+XMX8b0NJ17But3FSLxKQt
P1BumdT/ouxapgDLVpUzvRWi3utYCrTLoNaqqQXTLSaczabEtr8lJjEjHa5TIFy9i8/p
GzNp6qsw9IUq59XeuHmpKb6W7c59tyVTARq3gRnxkGRZLUvhbY18N3Ygxj3WSITcHiH+
GUwyk5yFDNEjSRrQI4zj6RPWCirPZ1smXpfWd1mV2a4gdVUwYnytL6SPkcW5bk56tIs1
cXDA==
X-Gm-Message-State: AOJu0YwriZ+GI8DU31wIsk+D+7zue5+uRbinR0Egv4LsuFKKajCpt6/l
bFlbkFamWzvvc92qwgwA9z7+5l541ME=
X-Google-Smtp-Source: AGHT+IHRFq530/g++OifMR5TBZZzMum3qxQd4zZ5PbtwP+UwHgZBN+BvKWPneyX0eg2M1XtGdk3rNw==
X-Received: by 2002:a67:fa93:0:b0:45d:9a4d:dc1b with SMTP id
f19-20020a67fa93000000b0045d9a4ddc1bmr8291419vsq.3.1701054936933;
Sun, 26 Nov 2023 19:15:36 -0800 (PST)
In-Reply-To: <91044403-9584-4161-a490-7cac3d8310a7@danceswithmice.info>
X-Mailer: Microsoft Outlook 16.0
Content-Language: en-us
Thread-Index: AQLE5XCijAbYn+n7sN9UKc2YtIQx7wCvRdtIAgiVzWYCiv+1DAItEPQ6Aq35/mwBgwsbAAFlSAE4AXsJLMCuQ+WbQA==
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <008d01da20df$fd06fb60$f714f220$@gmail.com>
X-Mailman-Original-References: <65547270.3139.338043@RealGrizzlyAdams.vivaldi.net>
<6555B48F.10108.156EC1@RealGrizzlyAdams.vivaldi.net>
<4626640f-4fe5-49bc-a6f8-d555b7f7b58a@tompassin.net>
<65561BDA.14413.9EACE9@RealGrizzlyAdams.vivaldi.net>
<016601da1f51$e4e84410$aeb8cc30$@gmail.com>
<mailman.289.1700883959.3828.python-list@python.org>
<ujt0i2$2r3tf$1@dont-email.me> <20231126210409.wbcdjkuxmwh7l23q@hjp.at>
<91044403-9584-4161-a490-7cac3d8310a7@danceswithmice.info>
 by: <avi.e.gross@gmail.com> - Mon, 27 Nov 2023 03:15 UTC

Dave,

Back on a hopefully more serious note, I want to make a bit of an analogy
with what happens when you save data in a format like a .CSV file.

Often you have a choice of including a header line giving names to the
resulting columns, or not.

If you read in the data to some structure, often to some variation I would
loosely call a data.frame or perhaps something like a matrix, then without
headers you have to specify what you want positionally or create your own
names for columns to use. If names are already there, your program can
manipulate things by using the names and if they are well chosen, with no
studs among them, the resulting code can be quite readable. More
importantly, if the data being read changes and includes additional columns
or in a different order, your original program may run fine as long as the
names of the columns you care about remain the same.

Positional programs can be positioned to fail in quite subtle ways if the
positions no longer apply.

As I see it, many situations where some aspects are variable are not ideal
for naming. A dictionary is an example that is useful when you have no idea
how many items with unknown keys may be present. You can iterate over the
names that are there, or use techniques that detect and deal with keys from
your list that are not present. Not using names/keys here might involve a
longer list with lots of empty slots to designate missing items, This
clearly is not great when the data present is sparse or when the number of
items is not known in advance or cannot be maintained in the right order.

There are many other situations with assorted tradeoffs and to insist on
using lists/tuples exclusively would be silly but at the same time, if you
are using a list to hold the real and imaginary parts of a complex number,
or the X/Y[/Z] coordinates of a point where the order is almost universally
accepted, then maybe it is not worth using a data structure more complex or
derived as the use may be obvious.

I do recall odd methods sometimes used way back when I programmed in C/C++
or similar languages when some method was used to declare small constants
like:

#define FIRSTNAME 1
#define LASTNAME 2

Or concepts like "const GPA = 3"

And so on, so code asking for student_record[LASTNAME] would be a tad more
readable and if the order of entries somehow were different, just redefine
the constant.

In some sense, some of the data structures we are discussing, under the
hood, actually may do something very similar as they remap the name to a
small integer offset. Others may do much more or be slower but often add
value in other ways. A full-blown class may not just encapsulate the names
of components of an object but verify the validity of the contents or do
logging or any number of other things. Using a list or tuple does nothing
else.

So if you need nothing else, they are often suitable and sometimes even
preferable.

-----Original Message-----
From: Python-list <python-list-bounces+avi.e.gross=gmail.com@python.org> On
Behalf Of DL Neil via Python-list
Sent: Sunday, November 26, 2023 5:19 PM
To: python-list@python.org
Subject: Re: Newline (NuBe Question)

On 11/27/2023 10:04 AM, Peter J. Holzer via Python-list wrote:
> On 2023-11-25 08:32:24 -0600, Michael F. Stemper via Python-list wrote:
>> On 24/11/2023 21.45, avi.e.gross@gmail.com wrote:
>>> Of course, for serious work, some might suggest avoiding constructs like
a >>> list of lists and switch to using modules and data structures [...]
>>
>> Those who would recommend that approach do not appear to include Mr.
>> Rossum, who said:
>> Avoid overengineering data structures.
> ^^^^^^^^^^^^^^^
>
> The key point here is *over*engineering. Don't make things more
> complicated than they need to be. But also don't make them simpler than
> necessary.
>
>> Tuples are better than objects (try namedtuple too though).
>
> If Guido thought that tuples would always be better than objects, then
> Python wouldn't have objects. Why would he add such a complicated
> feature to the language if he thought it was useless?
>
> The (unspoken?) context here is "if tuples are sufficient, then ..."

At recent PUG-meetings I've listened to a colleague asking questions and
conducting research on Python data-structures*, eg lists-of-lists cf
lists-of-tuples, etc, etc. The "etc, etc" goes on for some time!
Respecting the effort, even as it becomes boringly-detailed, am
encouraging him to publish his findings.

* sadly, he is resistant to OOP and included only a cursory look at
custom-objects, and early in the process. His 'new thinking' has been to
look at in-core databases and the speed-ups SQL (or other) might offer...

However, his motivation came from a particular application, and to
create a naming-system so that he could distinguish a list-of-lists
structure from some other tabular abstraction. The latter enables the
code to change data-format to speed the next process, without the coder
losing-track of the data-type/format.

The trouble is, whereas the research reveals which is faster
(in-isolation, and (only) on his 'platform'), my suspicion is that he
loses all gains by reformatting the data between 'the most efficient'
structure for each step. A problem of only looking at the 'micro',
whilst ignoring wider/macro concerns.

Accordingly, as to the word "engineering" (above), a reminder that we
work in two domains: code and data. The short 'toy examples' in training
courses discourage us from a design-stage for the former - until we
enter 'the real world' and meet a problem/solution too large to fit in a
single human-brain. Sadly, too many of us are pre-disposed to be
math/algorithmically-oriented, and thus data-design is rarely-considered
(in the macro!). Yet, here we are...

--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list

Re: Newline (NuBe Question)

<mailman.309.1701071355.3828.python-list@python.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=28972&group=comp.lang.python#28972

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: PythonList@danceswithmice.info ('DL Neil')
Newsgroups: comp.lang.python
Subject: Re: Newline (NuBe Question)
Date: Mon, 27 Nov 2023 20:49:07 +1300
Lines: 217
Message-ID: <mailman.309.1701071355.3828.python-list@python.org>
References: <65547270.3139.338043@RealGrizzlyAdams.vivaldi.net>
<6555B48F.10108.156EC1@RealGrizzlyAdams.vivaldi.net>
<4626640f-4fe5-49bc-a6f8-d555b7f7b58a@tompassin.net>
<65561BDA.14413.9EACE9@RealGrizzlyAdams.vivaldi.net>
<016601da1f51$e4e84410$aeb8cc30$@gmail.com>
<mailman.289.1700883959.3828.python-list@python.org>
<ujt0i2$2r3tf$1@dont-email.me> <20231126210409.wbcdjkuxmwh7l23q@hjp.at>
<91044403-9584-4161-a490-7cac3d8310a7@danceswithmice.info>
<008d01da20df$fd06fb60$f714f220$@gmail.com>
<ff27d002-d413-489c-9c8c-c96eac50adcf@danceswithmice.info>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de PVh7Xp1zaP5+vAhrvgWVvgzXhq42BgLTNygbLRedwOuQ==
Cancel-Lock: sha1:+P6ZVqRRRC0R7Wz4yIbXZt3R8bI= sha256:vz6qzl6Sh4/V4AVtGpzS5HAqDngCDz+EqRYRnIawpMs=
Return-Path: <PythonList@danceswithmice.info>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=danceswithmice.info header.i=@danceswithmice.info
header.b=Sn3YUeYB; dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.000
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'argument': 0.04; 'def':
0.04; "python's": 0.05; 'python:': 0.05; 'variable': 0.05;
'else.': 0.07; 'hopefully': 0.07; 'space,': 0.07; 'url:moin':
0.07; '=dn': 0.09; 'computing': 0.09; 'derived': 0.09; 'fact,':
0.09; 'filled': 0.09; 'from:addr:danceswithmice.info': 0.09;
'from:addr:pythonlist': 0.09; 'insist': 0.09; 'interfaces': 0.09;
'json': 0.09; 'matrix': 0.09; 'moved': 0.09; 'order,': 0.09;
'readable': 0.09; 'situations': 0.09; 'values.': 0.09;
'possible,': 0.15; 'problem.': 0.15; '(eg': 0.16; 'analogy': 0.16;
'aside': 0.16; 'assumption': 0.16; 'calculation': 0.16;
'calculation.': 0.16; 'chosen,': 0.16; 'column': 0.16; 'columns':
0.16; 'columns"': 0.16; 'confusion': 0.16; 'declare': 0.16;
'dicts': 0.16; 'expectation': 0.16; 'folk': 0.16; 'infamous':
0.16; 'integer': 0.16; 'items,': 0.16; 'iterate': 0.16;
'materially': 0.16; 'metric': 0.16; 'odd': 0.16; 'programmed':
0.16; 'reason.': 0.16; 'recall': 0.16; 'received:51.254': 0.16;
'received:51.254.211': 0.16; 'received:51.254.211.219': 0.16;
'received:cloud': 0.16; 'received:rangi.cloud': 0.16; 'specify':
0.16; 'structural': 0.16; 'structures': 0.16; 'subject:Newline':
0.16; 'tuple': 0.16; 'vector': 0.16; 'was:': 0.16; 'ways.': 0.16;
'whilst': 0.16; 'wrote:': 0.16; 'python': 0.16; 'values': 0.17;
'probably': 0.17; "aren't": 0.19; 'pm,': 0.19; 'subject:Question':
0.19; 'to:addr:python-list': 0.20; 'issue': 0.21; "i've": 0.22;
'languages': 0.22; 'maybe': 0.22; 'to:no real name:2**1': 0.22;
'code': 0.23; 'header': 0.23; 'url:wiki': 0.23; 'run': 0.23;
'idea': 0.24; '(and': 0.25; 'discussion': 0.25; 'cannot': 0.25;
'programming': 0.25; 'anyone': 0.25; 'seems': 0.26; 'again,':
0.26; 'justify': 0.26; 'object': 0.26; "isn't": 0.27; 'else':
0.27; 'bit': 0.27; 'function': 0.27; 'ideas': 0.28; 'suggest':
0.28; 'recently': 0.29; 'asked': 0.29; 'it,': 0.29; 'header:User-
Agent:1': 0.30; 'present': 0.30; 'apply.': 0.69; 'export': 0.69;
'latter': 0.69; 'order.': 0.69; 'slots': 0.69; 'terms': 0.70;
'raised': 0.70; 'resulting': 0.70; 'them,': 0.70; 'care': 0.71;
'longer': 0.71; 'deal': 0.73; 'easy': 0.74; 'bias': 0.76;
'choice': 0.76; 'formatting': 0.76; 'signature': 0.76; 'field':
0.78; 'database': 0.80; 'principles': 0.81; 'more.': 0.82;
'happens': 0.84; 'known': 0.84; '(along': 0.84; 'admit': 0.84;
'became': 0.84; 'coding.': 0.84; 'ease,': 0.84; 'enjoys': 0.84;
'feet': 0.84; 'handled': 0.84; 'importantly,': 0.84; 'indices':
0.84; 'positioned': 0.84; 'preferring': 0.84; 'subtle': 0.84;
'thus,': 0.84; 'us,': 0.89; 'amended': 0.91; 'avoiding': 0.91;
'brain': 0.91; 'errors,': 0.91; 'of:': 0.91; 'variation': 0.91;
'aspects': 0.93; 'positions': 0.96
DKIM-Filter: OpenDKIM Filter v2.11.0 vps.rangi.cloud 3D8DF4FCB
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=danceswithmice.info;
s=staff; t=1701071353;
bh=Q1ZE+g2Jgjfoun581W0qyg/EXohYHhF1+OBweyxiRjI=;
h=Date:Subject:To:References:From:In-Reply-To:From;
b=Sn3YUeYBNabgtIWvKgV0Wa59rNBGiE8XVNbyO2pJzrDLOepM4KLonkQmjTCwiyPWd
W6SR2jx7mXjxwdE7E2hK/2jRef7BjO8cJrrndMYq6+M2vOp50MvfZ9zGhB/Ghk99od
HDY3W+Epv1eQPgXtCvW37+7Yq8vqtCQWAfLYuqiyAjV+IQlvl13Ms+tkp4CmWnc3uq
KgK5EbBfmke0D6k/VvQoOcS/KZZEM6UBwSH3+CgPbJhylpU84C6UC5cWZ3INAmz2mA
Pdnq6oNK3W7gR61bKQbXW2bxq18BIty33t07hzZ/xIocvqm7Dch8gsaIbIFYIkY1Mu
5y8fWfV70fP6g==
User-Agent: Mozilla Thunderbird
Content-Language: en-US
In-Reply-To: <008d01da20df$fd06fb60$f714f220$@gmail.com>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <ff27d002-d413-489c-9c8c-c96eac50adcf@danceswithmice.info>
X-Mailman-Original-References: <65547270.3139.338043@RealGrizzlyAdams.vivaldi.net>
<6555B48F.10108.156EC1@RealGrizzlyAdams.vivaldi.net>
<4626640f-4fe5-49bc-a6f8-d555b7f7b58a@tompassin.net>
<65561BDA.14413.9EACE9@RealGrizzlyAdams.vivaldi.net>
<016601da1f51$e4e84410$aeb8cc30$@gmail.com>
<mailman.289.1700883959.3828.python-list@python.org>
<ujt0i2$2r3tf$1@dont-email.me> <20231126210409.wbcdjkuxmwh7l23q@hjp.at>
<91044403-9584-4161-a490-7cac3d8310a7@danceswithmice.info>
<008d01da20df$fd06fb60$f714f220$@gmail.com>
 by: 'DL Neil' - Mon, 27 Nov 2023 07:49 UTC

Avi,

On 11/27/2023 4:15 PM, avi.e.gross@gmail.com wrote:
> Dave,
>
> Back on a hopefully more serious note, I want to make a bit of an analogy
> with what happens when you save data in a format like a .CSV file.
>
> Often you have a choice of including a header line giving names to the
> resulting columns, or not.
>
> If you read in the data to some structure, often to some variation I would
> loosely call a data.frame or perhaps something like a matrix, then without
> headers you have to specify what you want positionally or create your own
> names for columns to use. If names are already there, your program can
> manipulate things by using the names and if they are well chosen, with no
> studs among them, the resulting code can be quite readable. More
> importantly, if the data being read changes and includes additional columns
> or in a different order, your original program may run fine as long as the
> names of the columns you care about remain the same.
>
> Positional programs can be positioned to fail in quite subtle ways if the
> positions no longer apply.

Must admit to avoiding .csv files, if possible, and working directly
with the .xls? original (cf expecting the user to export the .csv - and
NOT change the worksheet thereafter).

However, have recently been using the .csv format (as described) as a
placeholder or introduction to formatting data for an RDBMS.

In a tabular structure, the expectation is that every field (column/row
intersection) will contain a value. In the RDBMS-world, if the value is
not-known then it will be recorded as NULL (equivalent of Python's None).

Accordingly, two points:
1 the special case of missing/unavailable data can be handled with ease,
2 most 'connector' interfaces will give the choice of retrieving data
into a tuple or a dictionary (where the keys are the column-names). The
latter easing data-identification issues (as described) both in terms of
improving over relational-positioning and name-continuity (or column
changes/expansions).

The point about data 'appearing' without headings should be considered
carefully. The phrase "create your own names for columns" only vaguely
accesses the problem. If someone else has created/provided the data,
then we need to know the exact design (schema = rules). What is the
characteristic of each component? Not only column-names, but also what
is the metric (eg the infamous confusion between feet and meters)...

> As I see it, many situations where some aspects are variable are not ideal
> for naming. A dictionary is an example that is useful when you have no idea
> how many items with unknown keys may be present. You can iterate over the
> names that are there, or use techniques that detect and deal with keys from
> your list that are not present. Not using names/keys here might involve a
> longer list with lots of empty slots to designate missing items, This
> clearly is not great when the data present is sparse or when the number of
> items is not known in advance or cannot be maintained in the right order.

Agreed, and this is the draw-back incurred by folk who wish to take
advantage of the schema-less (possibility) NoSQL DBs. The DB enjoys
flexibility, but the downstream-coder has to contort and flex to cope.

In this case, JSON files are an easy place-holder/intro for NoSQL DBs -
in fact, Python dicts and MongoDB go hand-in-glove.

The next issue raised is sparseness. In a table, the assumption is that
all fields, or at least most of them, will be filled with values.
However, a sparse matrix would make such very 'expensive' in terms of
storage-space (efficacy).

Accordingly, there are other ways of doing things. All of these involve
labeling each data-item (thus, the data expressed as a table needs to be
at least 50% empty to justify the structural change).

In this case, one might consider a tree-type of structure - and if we
have to continue the pattern, we might look at a Network Database
methodology (as distinct from a DB on a network!)

> There are many other situations with assorted tradeoffs and to insist on
> using lists/tuples exclusively would be silly but at the same time, if you
> are using a list to hold the real and imaginary parts of a complex number,
> or the X/Y[/Z] coordinates of a point where the order is almost universally
> accepted, then maybe it is not worth using a data structure more complex or
> derived as the use may be obvious.

No argument (in case anyone thought I might...)

See @Peter's earlier advice.

Much of the consideration (apart from mutable/immutable) is likely to be
ease of coding. Getting down 'into the weeds' is probably pointless
unless questions are being asked about (execution-time) performance...

Isn't the word "obvious" where this discussion started? Whereas "studs"
might be an "obvious" abbreviation for "students" to some, it is not to
others (quite aside from the abbreviation being unnecessary in this
day-and-age).

Curiously, whereas I DO happen to think a point as ( x, y, ) or ( x, y,
z, ) and thus quite happily interpret ( 1, 2, 3, ) as a location in 3D
space, I had a trainee bring a 'problem' on this exact assumption:-

He had two positions ( x1, y1, ) and ( x2, y2, ) and was computing the
vector between them ( x2 - x1, y2 - y1 ), accordingly:

def compute_distance( x1, x2, y1, y2, ):
# with return calculated as above

Trouble is, the function-call was:

result = compute_distance( x1, y1, x2, y2, )

In other words, the function's signature was consistent with the
calculation. Whereas, the function-call was consistent with the way the
data had 'arrived'. Oops!

As soon as a (data)class Point( x, y, ) was created, the function's
signature became:

def compute_distance( starting_point:Point, ending_point:Point, ):
# with amended return calculation

and the function-call became congruent, naturally.
(in fact, the function was moved into the dataclass to become a method
which simplified the signature and call(s) )

Thus, what was "obvious" to the same guy's brain when he was writing the
function, and what seemed "obvious" when the function was being used,
were materially (and catastrophically) different!

So, even though we (two) might think in terms of "universally", we
are/were wrong!

Thus, a DESIGNED data-type helps to avoid errors, and even when the
data-usage seems "obvious", offers advantage!

Once again, am tempted to suggest that the saving of:

point = ( 1, 2, )

over:

@dataclass
class Point():
x:float
y:float

is about as easily justified as preferring "studs" over the complete
word "students".

YMMV!
(excepting Code Review expectations)

* will an AI-Assistant code this for us, and thus remove any 'amount of
typing' complaint?

> I do recall odd methods sometimes used way back when I programmed in C/C++
> or similar languages when some method was used to declare small constants
> like:
>
> #define FIRSTNAME 1
> #define LASTNAME 2
>
> Or concepts like "const GPA = 3"
>
> And so on, so code asking for student_record[LASTNAME] would be a tad more
> readable and if the order of entries somehow were different, just redefine
> the constant.

I've been known to do this in Python too! This example is congruent with
what was mentioned (elsewhere/earlier): that LASTNAME is considerably
more meaningful than 2.

Programming principles includes advice that all 'magic constants' should
be hoisted to the top of the code (along with import-statements). Aren't
those positional indices 'magic constants'?

> In some sense, some of the data structures we are discussing, under the
> hood, actually may do something very similar as they remap the name to a
> small integer offset. Others may do much more or be slower but often add
> value in other ways. A full-blown class may not just encapsulate the names
> of components of an object but verify the validity of the contents or do
> logging or any number of other things. Using a list or tuple does nothing
> else.

Not in Python: database keys must be hashable values - for that reason.

Argh! The docs (https://docs.python.org/3/tutorial/datastructures.html)
don't say that - or don't say it any more. Did it change when key-order
became guaranteed, or do I mis-remember?

Those docs say "immutable" - but whilst "hashable" and "immutable" have
related meanings, they are not exactly the same in effect.

Alternately, the wiki (https://wiki.python.org/moin/DictionaryKeys) does
say "hashable"!

> So if you need nothing else, they are often suitable and sometimes even
> preferable.

Yes, (make a conscious choice to) use the best tool for the job - but
don't let bias cloud your judgement, don't take the ideas of the MD's
nephew as 'Gospel', and DO design the way forward...


Click here to read the complete article
RE: Newline (NuBe Question)

<mailman.312.1701097297.3828.python-list@python.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=28976&group=comp.lang.python#28976

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: <avi.e.gross@gmail.com>
Newsgroups: comp.lang.python
Subject: RE: Newline (NuBe Question)
Date: Mon, 27 Nov 2023 10:01:32 -0500
Lines: 342
Message-ID: <mailman.312.1701097297.3828.python-list@python.org>
References: <65547270.3139.338043@RealGrizzlyAdams.vivaldi.net>
<6555B48F.10108.156EC1@RealGrizzlyAdams.vivaldi.net>
<4626640f-4fe5-49bc-a6f8-d555b7f7b58a@tompassin.net>
<65561BDA.14413.9EACE9@RealGrizzlyAdams.vivaldi.net>
<016601da1f51$e4e84410$aeb8cc30$@gmail.com>
<mailman.289.1700883959.3828.python-list@python.org>
<ujt0i2$2r3tf$1@dont-email.me> <20231126210409.wbcdjkuxmwh7l23q@hjp.at>
<91044403-9584-4161-a490-7cac3d8310a7@danceswithmice.info>
<008d01da20df$fd06fb60$f714f220$@gmail.com>
<ff27d002-d413-489c-9c8c-c96eac50adcf@danceswithmice.info>
<001a01da2142$9c4e5b70$d4eb1250$@gmail.com>
Mime-Version: 1.0
Content-Type: text/plain;
charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Trace: news.uni-berlin.de xdOQZE057UjUlZ1Mbsv5VQkIafd4QmvLTqSkuSjrQk7Q==
Cancel-Lock: sha1:1ruqT8LKOht5QDeFFsW+vmAEakg= sha256:Ya9rBPKyO7OnM/0FxQWcHfzDi7kBE/NaL8rRgxu6LUI=
Return-Path: <avi.e.gross@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=X7l2C29w;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.000
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'comments': 0.03; 'csv':
0.03; 'argument': 0.04; 'def': 0.04; 'containing': 0.05; 'fairly':
0.05; "python's": 0.05; 'python:': 0.05; 'variable': 0.05; '2023':
0.07; 'else.': 0.07; 'hopefully': 0.07; 'space,': 0.07;
'url:moin': 0.07; 'used.': 0.07; '27,': 0.09; '=dn': 0.09;
'characters,': 0.09; 'computing': 0.09; 'derived': 0.09;
'enough.': 0.09; 'environments': 0.09; 'fact,': 0.09; 'filled':
0.09; 'fyi,': 0.09; 'insist': 0.09; 'interfaces': 0.09; 'json':
0.09; 'matrix': 0.09; 'moved': 0.09; 'order,': 0.09; 'readable':
0.09; 'received:108': 0.09; 'situations': 0.09; 'values.': 0.09;
'possible,': 0.15; 'problem.': 0.15; '(eg': 0.16; 'analogy': 0.16;
'anything,': 0.16; 'applies': 0.16; 'arbitrary': 0.16;
'arguments': 0.16; 'aside': 0.16; 'assumption': 0.16;
'calculation': 0.16; 'calculation.': 0.16; 'characters.': 0.16;
'chosen,': 0.16; 'column': 0.16; 'columns': 0.16; 'columns"':
0.16; 'confusion': 0.16; 'declare': 0.16; 'dicts': 0.16;
'examples,': 0.16; 'expectation': 0.16; 'filename': 0.16; 'folk':
0.16; 'humans': 0.16; 'infamous': 0.16; 'integer': 0.16; 'items,':
0.16; 'iterate': 0.16; 'loops': 0.16; 'materially': 0.16;
'mentioned,': 0.16; 'metric': 0.16; 'nested': 0.16; 'newline':
0.16; 'odd': 0.16; 'programmed': 0.16; 'reason.': 0.16; 'recall':
0.16; 'received:mail-qv1-xf29.google.com': 0.16; 'relatively':
0.16; 'specify': 0.16; 'structural': 0.16; 'structures': 0.16;
'structures,': 0.16; 'subject:Newline': 0.16; 'subset': 0.16;
'things,': 0.16; 'tuple': 0.16; 'useful.': 0.16; 'vector': 0.16;
'was:': 0.16; 'ways.': 0.16; 'whatever.': 0.16; 'whilst': 0.16;
'wish.': 0.16; 'wrote:': 0.16; 'python': 0.16; 'values': 0.17;
'probably': 0.17; 'message-id:@gmail.com': 0.18; "aren't": 0.19;
'name.': 0.19; 'pm,': 0.19; 'subject:Question': 0.19; 'to:addr
:python-list': 0.20; 'issue': 0.21; 'language': 0.21; "i've":
0.22; 'languages': 0.22; 'focused': 0.22; 'maybe': 0.22;
'version': 0.23; 'code': 0.23; 'sent:': 0.78; 'field': 0.78;
'major': 0.78; 'database': 0.80; 'principles': 0.81; 'position':
0.81; 'more.': 0.82; 'happens': 0.84; 'known': 0.84; 'weight':
0.84; '(along': 0.84; 'admit': 0.84; 'became': 0.84; 'characters':
0.84; 'coding.': 0.84; 'components.': 0.84; 'ease,': 0.84;
'enjoys': 0.84; 'feet': 0.84; 'handled': 0.84; 'importantly,':
0.84; 'indices': 0.84; 'metrics': 0.84; 'positioned': 0.84;
'preferring': 0.84; 'subtle': 0.84; 'thus,': 0.84; 'valid,': 0.84;
'want.': 0.84; 'us,': 0.89; 'amended': 0.91; 'avoiding': 0.91;
'brain': 0.91; 'convenience': 0.91; 'errors,': 0.91; 'of:': 0.91;
'variation': 0.91; 'aspects': 0.93; 'line,': 0.93; 'storage':
0.95; 'positions': 0.96
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1701097294; x=1701702094; darn=python.org;
h=thread-index:content-language:content-transfer-encoding
:mime-version:message-id:date:subject:in-reply-to:references:to:from
:from:to:cc:subject:date:message-id:reply-to;
bh=1rg8vi21a2f/hwqYxLOE6EBltvQ4FU0q/jF001+oaHw=;
b=X7l2C29w5HX4RaWIX2ejBQeC7v6Q1k4MyeWZ/HGh+sbkyr4YnIKiMMzQnWZLg4JMD3
Zqu8blRJTqUZ5bp50chMKzYU6mlnQLDTTOU3XMEqzudS5YHh+uUl1GBVRmfvhdJRbFLz
YWw+nvSGfYkGKeAfSTyCcBYQSvr7VyVnZg3+H6oWM9M2uLoDasl/pr1C/zfLqarhujJv
hKvgT4jCsTCbr9qS3EeO9mqCepcD81aBUKlQSe/xCRKtQAwGhMHMUX03TUD/nDLcRAmW
hJMNe0G30er3Dd/1XnXwH3csA7VrBOc/nIZENsRVgnZjkDHbGiaw1vaVt56UiDXJmxuu
C3/g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1701097294; x=1701702094;
h=thread-index:content-language:content-transfer-encoding
:mime-version:message-id:date:subject:in-reply-to:references:to:from
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=1rg8vi21a2f/hwqYxLOE6EBltvQ4FU0q/jF001+oaHw=;
b=PuYE+HXaB8JqJ/qtELX8FnNFSpIaRxSgkCgurtvhtOS6kZ2hFND1g9VXMqxWJQ5cIC
TmNNHe5gO7sRQ1/5uixZirXgw+1kUikcM8EED9N2mdP5Cv3iTG5eSOe6V//JsjO68IDq
vRws9PczEvLk1Nn3BprZjXUpk47PIjEC5SHb+mmceWrBpV1sZuRbdf3oHzr9wj0rvRVC
fKgfyJGwXkE1X5HRDJnNsCrzXc8rD/Wam9yajjooKisSPltKRU1BOFckRJVX1Xkdd8cD
V+bGI1C7vnvw46/cybNHiGhIP81PNC7RyuEElnoW/bUh5Lxo+A5YWANBwRyPC2T0Sp+2
oEmg==
X-Gm-Message-State: AOJu0YxNzgopVIU9yW3eamIFZvsq4BwytcXQvWPjfH20Mwstwm7aSWOd
ThGSTqjAA/UYpqv1LU6gm+kBN9xS93U=
X-Google-Smtp-Source: AGHT+IFBvcTyU8140N3LVlZ51mq5+m7zQffCKO2jCh1CdFVNF/KhJM9OO6Z5nJ0WrWD+y3OpWGs/3w==
X-Received: by 2002:ad4:444a:0:b0:67a:211b:29ef with SMTP id
l10-20020ad4444a000000b0067a211b29efmr10557668qvt.41.1701097293978;
Mon, 27 Nov 2023 07:01:33 -0800 (PST)
In-Reply-To: <ff27d002-d413-489c-9c8c-c96eac50adcf@danceswithmice.info>
X-Mailer: Microsoft Outlook 16.0
Content-Language: en-us
Thread-Index: AQLE5XCijAbYn+n7sN9UKc2YtIQx7wCvRdtIAgiVzWYCiv+1DAItEPQ6Aq35/mwBgwsbAAFlSAE4AXsJLMABuqguZALjuhl0rh+1NmA=
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <001a01da2142$9c4e5b70$d4eb1250$@gmail.com>
X-Mailman-Original-References: <65547270.3139.338043@RealGrizzlyAdams.vivaldi.net>
<6555B48F.10108.156EC1@RealGrizzlyAdams.vivaldi.net>
<4626640f-4fe5-49bc-a6f8-d555b7f7b58a@tompassin.net>
<65561BDA.14413.9EACE9@RealGrizzlyAdams.vivaldi.net>
<016601da1f51$e4e84410$aeb8cc30$@gmail.com>
<mailman.289.1700883959.3828.python-list@python.org>
<ujt0i2$2r3tf$1@dont-email.me> <20231126210409.wbcdjkuxmwh7l23q@hjp.at>
<91044403-9584-4161-a490-7cac3d8310a7@danceswithmice.info>
<008d01da20df$fd06fb60$f714f220$@gmail.com>
<ff27d002-d413-489c-9c8c-c96eac50adcf@danceswithmice.info>
 by: <avi.e.gross@gmail.com> - Mon, 27 Nov 2023 15:01 UTC

Dave, I gave an example, again, and make no deep claims so your comments may be valid, without any argument.

I mentioned CSV and a related family such as TSV as they were a common and simple data format that has long been used. There are oodles of others and yes, these days many people can read directly from formats like some from EXCEL. But for data that can be shared to almost anyone using anything, something like Comma Separated Values is often used.

And some programs that generate such data simply keep appending a line at a time to a file and do not have any header line. There are even some programs that may not tolerate a file with a header line, or comments or other optional things, and some where header lines you can create would cause problems such as using an extended character set or escaped characters.

I have worked with these files in many languages and environments and my thought process here focused on recent work in R, albeit much applies everywhere. My point was really not about CSV but the convenience and advantages of data structures you can access by name when you want and sometimes also by position when you want. Too many errors can happen when humans doing programming are not able to concentrate. It is similar to arguments about file names. In the old UNIX days, and the same for other systems like VMS, a filename tended to have a format where relatively few characters were allowed and it might have two parts with the latter being an extension of up to 3 characters, or whatever. So file names like A321G12.dat were common and also next to it similar unpronounceable other file names. It was easy to confuse them and even people who worked with them regularly would forget what it might mean or use the wrong one.

Well, if I load in a CSV in a language like R and there is no header line, as with some other data structures, it may make up a placeholder set of names like V1, V2 and so on. Yes, there are ways to specify the names as they are read in or afterward and they can be changed. But I have seen lots of CSV files offered with way too many columns and no names as well as documentation suggesting what names can be added if you wish.

This may be a bit off topic, but I want to add a bit in this context about additional concepts regarding name. As mentioned, there is a whole set of add-ons people sometimes use and in R, I like the tidyverse family and it allows some fairly sophisticated things to be done using names. There are ways to specify you want a subset of a data.frame (sometimes a version called a tibble) and you can ask for say all columns starting with "xyz" or containing it or ending with it. That can be very helpful if say we wave columns containing the height and weight and other metrics of say people in three clinics and your column names embed the name of the clinic, or other such examples, and you want to select one grouping for processing. You cannot easily do that without external info is it is just positional.

An extension of this is how compactly you can do fairly complex things such as asking to create lots of new columns using calculations. You can specify, as above, which sets of columns to do this too and that you want the results for each XYY in XYZ.mean and XYZ.std and so on. You can skip oodles of carefully crafted and nested loops because of the ability to manipulate using column names at a high and often abstract level.

And, just FYI, many other structures such as lists in R also support names for components. It can be very useful. But the overall paradigm compared to Python has major differences and I see strengths and weaknesses and tradeoffs.

Your dictionary example is one of them as numpy/pandas often make good use of them as part of dealing with similar data.frame type structures that are often simpler or easier to code with.

There is lots of AI discussion these days and some of what you say is applicable in that additional info besides names might be useful in the storage format to make processing it more useful. That is available in formats related to XML where fairly arbitrary markup can be made available.

Have to head out as this is already long enough.

-----Original Message-----
From: 'DL Neil' <PythonList@danceswithmice.info>
Sent: Monday, November 27, 2023 2:49 AM
To: avi.e.gross@gmail.com; python-list@python.org
Subject: Re: Newline (NuBe Question)

Avi,

On 11/27/2023 4:15 PM, avi.e.gross@gmail.com wrote:
> Dave,
>
> Back on a hopefully more serious note, I want to make a bit of an analogy
> with what happens when you save data in a format like a .CSV file.
>
> Often you have a choice of including a header line giving names to the
> resulting columns, or not.
>
> If you read in the data to some structure, often to some variation I would
> loosely call a data.frame or perhaps something like a matrix, then without
> headers you have to specify what you want positionally or create your own
> names for columns to use. If names are already there, your program can
> manipulate things by using the names and if they are well chosen, with no
> studs among them, the resulting code can be quite readable. More
> importantly, if the data being read changes and includes additional columns
> or in a different order, your original program may run fine as long as the
> names of the columns you care about remain the same.
>
> Positional programs can be positioned to fail in quite subtle ways if the
> positions no longer apply.

Must admit to avoiding .csv files, if possible, and working directly
with the .xls? original (cf expecting the user to export the .csv - and
NOT change the worksheet thereafter).

However, have recently been using the .csv format (as described) as a
placeholder or introduction to formatting data for an RDBMS.

In a tabular structure, the expectation is that every field (column/row
intersection) will contain a value. In the RDBMS-world, if the value is
not-known then it will be recorded as NULL (equivalent of Python's None).

Accordingly, two points:
1 the special case of missing/unavailable data can be handled with ease,
2 most 'connector' interfaces will give the choice of retrieving data
into a tuple or a dictionary (where the keys are the column-names). The
latter easing data-identification issues (as described) both in terms of
improving over relational-positioning and name-continuity (or column
changes/expansions).

The point about data 'appearing' without headings should be considered
carefully. The phrase "create your own names for columns" only vaguely
accesses the problem. If someone else has created/provided the data,
then we need to know the exact design (schema = rules). What is the
characteristic of each component? Not only column-names, but also what
is the metric (eg the infamous confusion between feet and meters)...

> As I see it, many situations where some aspects are variable are not ideal
> for naming. A dictionary is an example that is useful when you have no idea
> how many items with unknown keys may be present. You can iterate over the
> names that are there, or use techniques that detect and deal with keys from
> your list that are not present. Not using names/keys here might involve a
> longer list with lots of empty slots to designate missing items, This
> clearly is not great when the data present is sparse or when the number of
> items is not known in advance or cannot be maintained in the right order.

Agreed, and this is the draw-back incurred by folk who wish to take
advantage of the schema-less (possibility) NoSQL DBs. The DB enjoys
flexibility, but the downstream-coder has to contort and flex to cope.

In this case, JSON files are an easy place-holder/intro for NoSQL DBs -
in fact, Python dicts and MongoDB go hand-in-glove.

The next issue raised is sparseness. In a table, the assumption is that
all fields, or at least most of them, will be filled with values.
However, a sparse matrix would make such very 'expensive' in terms of
storage-space (efficacy).

Accordingly, there are other ways of doing things. All of these involve
labeling each data-item (thus, the data expressed as a table needs to be
at least 50% empty to justify the structural change).

In this case, one might consider a tree-type of structure - and if we
have to continue the pattern, we might look at a Network Database
methodology (as distinct from a DB on a network!)

> There are many other situations with assorted tradeoffs and to insist on
> using lists/tuples exclusively would be silly but at the same time, if you
> are using a list to hold the real and imaginary parts of a complex number,
> or the X/Y[/Z] coordinates of a point where the order is almost universally
> accepted, then maybe it is not worth using a data structure more complex or
> derived as the use may be obvious.

No argument (in case anyone thought I might...)

See @Peter's earlier advice.

Much of the consideration (apart from mutable/immutable) is likely to be
ease of coding. Getting down 'into the weeds' is probably pointless
unless questions are being asked about (execution-time) performance...

Isn't the word "obvious" where this discussion started? Whereas "studs"
might be an "obvious" abbreviation for "students" to some, it is not to
others (quite aside from the abbreviation being unnecessary in this
day-and-age).


Click here to read the complete article

devel / comp.lang.python / RE: Newline (NuBe Question)

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor