RFC: For Loop Invariants

Souvik Dutta souvik.viksou at gmail.com
Sat Apr 11 00:47:11 EDT 2020


Ah yes it's an iterable not a condition. Sorry about that. 😛😛

Souvik flutter dev

On Sat, Apr 11, 2020, 6:38 AM Chris Angelico <rosuav at gmail.com> wrote:

> On Sat, Apr 11, 2020 at 11:04 AM Souvik Dutta <souvik.viksou at gmail.com>
> wrote:
> >
> > How about completely removing the need for an if statement by allowing
> for multiple conditions to be inserted in the for loop?? That would make
> reading and writing a lot easier. Like the count problem could be rewritten
> as
> > for (a in chars and <the other list> ):
> >     count+=1
> >
>
> A loop fundamentally has to have an iterable and an assignment target
> (usually a variable). That's not a condition, it's a loop. The only
> reason it looks like multiple conditions is that the "in" keyword is
> doing two slightly different things here :)
>
> ChrisA
> --
> https://mail.python.org/mailman/listinfo/python-list
>


More information about the Python-list mailing list