return command in a function.

David Bolen db3l at fitlinxx.com
Thu Sep 27 14:10:01 EDT 2001


"Boyd Roberts" <boyd at insultant.net> writes:

> "Travers Naran" <tnaran at direct.ca> a écrit dans le message news: 9oudgb0vnk at enews2.newsguy.com...
> > A return mid-way through a function is controversial.
> 
> i don't think so, because it's well defined where it's going to;
> much like break and continue.
> 
> a goto could take you anywhere and complicates the 'state' and
> control flow of the function.

It's controversial at least (IMO) because it violates the one entry,
one exit theory, and can also make it harder to maintain a function
that may need to perform cleanup of local resources before exit.

Whether or not a given person agrees with those (or other) issues is
open to debate, thus the controversy.

Unless your "i don't think so" was just agreeing that it's
controversial :-)

--
-- David
-- 
/-----------------------------------------------------------------------\
 \               David Bolen            \   E-mail: db3l at fitlinxx.com  /
  |             FitLinxx, Inc.            \  Phone: (203) 708-5192    |
 /  860 Canal Street, Stamford, CT  06902   \  Fax: (203) 316-5150     \
\-----------------------------------------------------------------------/



More information about the Python-list mailing list