[Tutor] line labels?
Lance E Sloan
lsloan@umich.edu
Wed, 23 May 2001 09:49:15 -0400
Does Python support labelling lines of code? I was just in the
middle of supporting some Perl poorly-written by somebody else
when I saw constructs like this:
while0:
while(1) {
do something...
while1:
while (&read_input) {
do something...
if (condition) {
last while1;
}
}
if (condition) {
last while0;
}
}
I know that C has something like this and you can use "goto" statements.
Personally, I consider using those labels in Perl and C to be bad
form and "goto" is just plain heinous.
I'm really enjoying learning Python. I hope it doesn't have this
feature. I think it would allow programmers to develop bad habits and
hard-to-maintain code. For example, in the Perl example above, I
think the code would work as it is if the labels were deleted.
--
Lance E Sloan
Web Services, Univ. of Michigan: Full-service Web and database design,
development, and hosting. Specializing in Perl & Python CGIs.
http://websvcs.itd.umich.edu/ - "Putting U on the Web"