Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"Jesus saves...but Gretzky gets the rebound!" -- Daniel Hinojosa (hinojosa@hp-sdd)


devel / comp.lang.python / Re: on the popularity of loops while and for

SubjectAuthor
* Re: on the popularity of loops while and forBarry
`- Re: on the popularity of loops while and forHope Rouselle

1
Re: on the popularity of loops while and for

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: bar...@barrys-emacs.org (Barry)
Newsgroups: comp.lang.python
Subject: Re: on the popularity of loops while and for
Date: Sun, 29 Aug 2021 10:04:47 +0100
Lines: 32
Message-ID: <mailman.493.1630227899.4164.python-list@python.org>
References: <E88B333B-5CF5-4B98-9A3E-13EDBE069A1A@barrys-emacs.org>
Mime-Version: 1.0 (1.0)
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Trace: news.uni-berlin.de fY4Fh7Cj7iF7mQRgbd/8kAk3tewEHI861sOzHKsdq6Fw==
Return-Path: <barry@barrys-emacs.org>
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; 'comments': 0.04;
"python's": 0.05; 'loop': 0.07; 'loops.': 0.07; 'url:mailman':
0.09; 'aug': 0.09; 'barry': 0.09; 'from:addr:barry': 0.09;
'practice.': 0.09; 'received:217.70': 0.09; 'received:gandi.net':
0.09; 'received:mail.gandi.net': 0.09; 'way?': 0.09; 'easy,':
0.16; 'for.': 0.16; 'from:addr:barrys-emacs.org': 0.16; 'loops':
0.16; 'lot,': 0.16; 'message-id:@barrys-emacs.org': 0.16;
'subject:popularity': 0.16; 'subject:while': 0.16; 'wrote:': 0.16;
'url:listinfo': 0.16; 'python': 0.16; 'instead': 0.17;
'libraries': 0.20; 'url-ip:188.166.95.178/32': 0.20; 'url-
ip:188.166.95/24': 0.20; 'url-ip:188.166/16': 0.23; "i'd": 0.23;
'to:addr:python-list': 0.23; 'code': 0.24; "i'll": 0.28; 'url-
ip:188/8': 0.29; 'think': 0.31; 'but': 0.31; 'do.': 0.32;
'subject:for': 0.33; 'trying': 0.36; 'cases': 0.37; 'those': 0.38;
'something': 0.38; 'use': 0.38; 'among': 0.61; 'english': 0.61;
'love': 0.61; 'hope': 0.61; 'ever': 0.63; 'look': 0.66; 'choice':
0.68; 'received:217': 0.68; 'interesting': 0.71; 'know.': 0.72;
'life': 0.76; 'casual': 0.84; 'strings': 0.84; 'vs.': 0.84
X-Mailer: iPad Mail (18G82)
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.34
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: <E88B333B-5CF5-4B98-9A3E-13EDBE069A1A@barrys-emacs.org>
 by: Barry - Sun, 29 Aug 2021 09:04 UTC



> On 28 Aug 2021, at 22:42, Hope Rouselle <hrouselle@jevedi.com> wrote:
>
> I'd like get a statistic of how often each loop is used in practice.
>
> I was trying to take a look at the Python's standard libraries --- those
> included in a standard installation of Python 3.9.6, say --- to see
> which loops are more often used among while and for loops. Of course,
> since English use the preposition ``for'' a lot, that makes my life
> harder. Removing comments is easy, but removing strings is harder. So
> I don't know yet what I'll do.
>
> Have you guys ever measured something like that in a casual or serious
> way? I'd love to know. Thank you!

I am interesting in why you think that choice of while vs. for is about popularity?

Surely the choice is made in most cases by the algorithm?
If you have an iterator then you use for.
Of course you can use while instead of for but in code review that will get queried.

Barry

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

Re: on the popularity of loops while and for

<86k0jzm7kc.fsf@jevedi.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!aioe.org!4+bwgJ580lENslyh7E5FoA.user.46.165.242.75.POSTED!not-for-mail
From: hrouse...@jevedi.com (Hope Rouselle)
Newsgroups: comp.lang.python
Subject: Re: on the popularity of loops while and for
Date: Thu, 02 Sep 2021 10:27:15 -0300
Organization: Aioe.org NNTP Server
Message-ID: <86k0jzm7kc.fsf@jevedi.com>
References: <E88B333B-5CF5-4B98-9A3E-13EDBE069A1A@barrys-emacs.org>
<mailman.493.1630227899.4164.python-list@python.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: gioia.aioe.org; logging-data="17947"; posting-host="4+bwgJ580lENslyh7E5FoA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
Cancel-Lock: sha1:al4KAu2djpE4ojRlFak/TSn1MLo=
X-Notice: Filtered by postfilter v. 0.9.2
 by: Hope Rouselle - Thu, 2 Sep 2021 13:27 UTC

Barry <barry@barrys-emacs.org> writes:

>> On 28 Aug 2021, at 22:42, Hope Rouselle <hrouselle@jevedi.com> wrote:
>>
>> I'd like get a statistic of how often each loop is used in practice.
>>
>> I was trying to take a look at the Python's standard libraries --- those
>> included in a standard installation of Python 3.9.6, say --- to see
>> which loops are more often used among while and for loops. Of course,
>> since English use the preposition ``for'' a lot, that makes my life
>> harder. Removing comments is easy, but removing strings is harder. So
>> I don't know yet what I'll do.
>>
>> Have you guys ever measured something like that in a casual or serious
>> way? I'd love to know. Thank you!
>
> I am interesting in why you think that choice of while vs. for is
> about popularity?

Perhaps you think my choice of "popular" had a special judgement about
it. Let's define "popular" in the way that I used it.

--8<---------------cut here---------------start------------->8---
Definition. We say x is more popular than y if x appears more times
relative to y when considered in a sample.

Example. For loops are more popular than while loops in a certain
sample because they appeared 17 times compared to 5 times the while loop
appeared.
--8<---------------cut here---------------end--------------->8---

So it's just a numeric comparison.

[...]

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor