> On 28 Aug 2021, at 22:42, Hope Rouselle <hrouse...@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

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

Reply via email to