Is it possible to implement a Python for range loop without an iterator variable? -


Is it possible to do the following without i ?

  (some_number) for something in the category: # do something  

If you want to make N sum of some time and do not need an iterator is.

away from the top of my head, no.

I think that whatever you can do is something like this: DIF Loop (F, N) P> for but I think you can stay with the extra i variable.

Here is the option to use the _ variable, which in fact, this is just another variable.

  for range (n): do_something ()  

Note that _ is assigned to the end result which An interactive dragon returned to session:

  & gt; & Gt; & Gt; 1 + 2 3 & gt; & Gt; & Gt; _ 3  

For this reason, I will not use it in this way, I am unaware of any of the words mentioned by Ryan, it can mess up your interpreter.

  & gt; & Gt; & Gt; For Xchange (10) _: pass ... & gt; & Gt; & Gt; _ 9 & gt; & Gt; & Gt; 1 + 2 3 & gt; & Gt; & Gt; _ 9  

And accordingly, this is an acceptable variable name:

Identifier: = (letter | "_") (letter | digit | _ ") *


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -