Thread: Python brevity
View Single Post
Old May 22nd, 2006, 11:36 AM   #10
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
It wasn't directed at you, Arevos, it was directed at the rewriting of my code from
medList.append ([found for found in sets.group (1, 2, 3) if found != None])
to
if found is not None] # "is not" is safer practice in general
which is an explicit tutorial comment. In fact, the thread HAS been educational. I diverted from my course long enough to go check out generators. I see their utility, but it isn't applicable in this case. The code exists in one place and gets two passes (one for each of two classes of tags). Of particular value to me was discovering the packer/unpacker capability (*group) along the way.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote