eric3 question

Alexander Alexander_Zatvornitskiy at p131.f3.n5025.z2.fidonet.org
Wed Jun 1 15:18:46 EDT 2005


Привет Magnus!

31 мая 2005 в 13:46, Magnus Lycka в своем письме к All писал:
 ML> The readline method includes the whole line, including the
 ML> linefeed character if you press q followed by ENTER. If you
 ML> change it to...

 ML>     while not sys.stdin.readline()=="q\n":
oooops. I'am usually use Ctrl+C to break my program, so this bug was not found
by me.
 ML> ...I guess it will work in eric3. (It works in IDLE then.)
no. under eric3, exception "The socket operation could not completed without
blocking" on line 160 in AsincFile.py (this file is from python's
distribution). It seems, cause of bug is in method of redirection the console
input/output to eric's windows.

Btw, raw_input works fine.

 ML> In general, your construct makes it a bit difficult for you
 ML> to debug your own code. If you had written it like below...

 ML> while True:
 ML>      inp = sys.stdin.readline()
 ML>      if inp == 'q':
 ML>          break
 ML>      smthing(else) # Not that you can use else as a name...
I hate such loops. Usually, if I see the loop, I want to see its condition at
once, I don't want to search for it. In my opinion, "while True"+"break" is
something like "goto"+"if" or even worse.
 ML> Changes and experiments like that are very easy to do in
 ML> Python. It beats staring at the code in confusion 99 times
 ML> out of 100. It's typically much faster than asking on c.l.py,
 ML> although not educational for as many people... ;)
Anyway, now you know that eric3 use (possibly) little bit buggy mechanism for
redirection of input/output. It's cool:)

Alexander, zatv at bk.ru



More information about the Python-list mailing list