Skip to Content.
Sympa Menu

byte-of-python - Re: [Byte-of-Python] Suggestion: rephrase explanation of while-else

byte-of-python AT lists.ibiblio.org

Subject: Discussion regarding the book 'A Byte of Python'

List archive

Chronological Thread  
  • From: Swaroop C H <g2swaroop AT yahoo.com>
  • To: Discussion regarding the book 'A Byte of Python' <byte-of-python AT lists.ibiblio.org>
  • Subject: Re: [Byte-of-Python] Suggestion: rephrase explanation of while-else
  • Date: Tue, 26 Jul 2005 15:03:29 +0530

Hey Manish,

Thanks for the feedback.
I've already changed some parts of the explanation in my working copy, but I'll check again regarding your suggestions :)

Thanks,
Swaroop C H
www.swaroopch.info




On 24-Jul-05, at 6:04 PM, Manish Malik wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Hi,

A quick note of Thanks for the book :-)
and a suggestion:

Chapter 6 (Control Flow), The while statement:
- -----------------------------------------------
"If there is an else clause for a while loop, it is always executed
unless you have a while loop which loops forever without ever breaking
out!"

This is followed by:
"The else-block is actually redundant since you can put those
statements in the same block (as the while statement) after the while
statement to get the same effect."


Here, the reader may get an impression of the definiteness that the
else-clause is *always* executed unless the while loops forever.
However, this is not the case (as stated in the quoted text from
'break statement' section below.) The else-block is not redundant,
since it may contain statements that need to be executed only in case
of a non-break (i.e. not using the 'break' statement) exit from the loop.


A couple of sections later, 'The break statement':
- --------------------------------------------------

"An important note is that if you break out of a for or while loop,
any corresponding loop else block is not executed."


I would suggest that a reference to this fact be included in the
'while statement' section. This may get things straight for the user
who reads this particular section in isolation.

Comments?

Thanks,
Manish

mm .at. bbspals .dot. org
mm .dot. bbspals .dot. org


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFC44q69364pdQFFqARAnh5AJ4g/q7QTcfu+gmIOSEPDAeeFUOkaACdFsw1
04elcLFxnZ6S/Hr9nuQa/AU=
=bTJk
-----END PGP SIGNATURE-----

_______________________________________________
Byte-of-Python mailing list
Byte-of-Python AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/byte-of-python






Archive powered by MHonArc 2.6.24.

Top of Page