Replace for Goto
Martin Maney
maney at pobox.com
Sun Jun 1 21:53:29 EDT 2003
Aahz <aahz at pythoncraft.com> wrote:
> try:
> for ORlist in includes:
> try:
> for filter in ORlist:
> for field in curr_fields:
> for item in record[field]:
> if item.lower().find(filter) >= 0:
> raise Found
> else:
> raise NotFound
> except Found:
> continue
> except NotFound:
> continue
> else:
> result.append(record)
Speaking as one who has indented deeply when it felt appropriate, and
actually used a triply-indirect pointer (not nested structures, just a
few points where the code reached all the way to ***whatsit... and it
did work and seemed perfectly reasonable at the time it was written)...
That's scary. Or was it intended as the single example for a long
afternoon demonstrating the effects of refactoring on code readability?
:-)
--
Here's my message to the record industry and its allies:
I'm not a thief. I'm a customer. When you treat me like a
thief, I won't be your customer. -- Dan Gillmor
More information about the Python-list
mailing list