29 Aug 2008 29 Aug '08
On Fri, Aug 29, 2008 at 6:25 PM, Bruce Leban email@example.com wrote:
On Fri, Aug 29, 2008 at 1:47 PM, David Blaschke firstname.lastname@example.org wrote:
This idea elif x == funky_empty: result = 'no data'
Can be accomplished with if not len(items): result = 'no data' which means that part of the proposal can be scratched IMHO.
Not quite: len(items) requires iterating across the entire list which may not be necessary or desirable. Plus you may need an intermediate variable to store it. I think that's inferior.
If len(items) requires iterating across the entire list, then you're not using a Python list object, you're using someone else's (poorly implemented) list data structure. Python lists give len(obj) in O(1).
-- I'm not *in*-sane. Indeed, I am so far *out* of sane that you appear a tiny blip on the distant coast of sanity. --- Bucky Katt, Get Fuzzy