Movatterモバイル変換


[0]ホーム

URL:


Named code blockes

Steven D. Majewskisdm7g at Virginia.EDU
Sat Apr 14 16:55:19 EDT 2001


On Sat, 14 Apr 2001, Alex Martelli wrote:> I would.  If one can break out of one level of loop with the break> statement, why would exceptions be the 'designed' way to break> out of two or three levels?  It's not that rare a need.  It's not an> issue of optimization for me, but of clear and explicit expression> of design intent.I agree it's an issue of clear and explicit expression. We just have a difference of opinion over whether labeled blocksand multiple level breaks deliver on that clear and explicit expression. I would actually find GOTO's *MORE* clear and explicit provided everyone had the discipline to use them in a restricted and structuredmanner. (ala. Knuth, Structured Programming with Goto)Typically, a named block has the name label at the top -- which isnot usually where the control is flowing to, and you have to huntand peek around to find the next executable statement. What's clearand explicit about that ?A restricted use of GOTO is more (IMHO) clear. try/except blocks come in somewhere in between Goto and namedblocks for readability. Not a bad compromise if you don't wantto rely on disciplined use of goto. The target is pretty clear.( But maybe you're thinking of a different syntax for Python   than I can imagine from other lang. I've seen. If you show  me a clear example, I'll reconsider. ) -- Steve Majewski


More information about the Python-listmailing list

[8]ページ先頭

©2009-2025 Movatter.jp