problems with looping, i suppose

Sion Arrowsmith siona at chiark.greenend.org.uk
Tue Mar 28 07:17:38 EST 2006


John Salerno  <johnjsal at NOSPAMgmail.com> wrote:
>Does what I originally pasted in my message look incorrect? To me, it 
>all seems indented properly.

Yes. Somewhere or other you've got your tabstop set to 4, and python
treats literal tabs as being of equivalent indent to 8 spaces. As
does my newsreader, so the problem was obvious:

while True:
        tries += 1
^ This was a tab (my cut&paste has turned it back into spaces)
        try:
^ This was a tab too.
        if guess == number:
^^^^^^^^ This was eight spaces even before I cut&pasted.

-- 
\S -- siona at chiark.greenend.org.uk -- http://www.chaos.org.uk/~sion/
  ___  |  "Frankly I have no feelings towards penguins one way or the other"
  \X/  |    -- Arthur C. Clarke
   her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump



More information about the Python-list mailing list