On 9/29/10 5:19 PM, Ed Leafe wrote:
> On Sep 29, 2010, at 6:35 PM, Paul McNett wrote:
>
>> I wish biz.seek() returned a bool, not the row number. I never care what row 
>> number
>> was found - I could query biz.RowNumber after seek() if I did - and 
>> returning a bool
>> would simplify my calls from, for example:
>>
>>    if biz.seek(candidate_id, "id")>= 0:
>>
>> to:
>>
>>    if biz.seek(candidate_id, "id"):
>>
>> I know it is only a little bit shorter but that's not the real point: I 
>> always have
>> to remember to check for the case of the 0 return value (which means a match 
>> was
>> found at row 0, not that a match wasn't found). If I forget, a potentially 
>> very
>> subtle bug creeps in.
>>
>> I guess we'd need to define a new function instead though, to avoid breaking 
>> existing
>> code?
>
>
>       The bool aspect kinda fails with near=True, right?

Not necessarily: it could always return True with near=True, if there are any 
records 
at all. But I don't think I have any use case for near=True (I'll do a grep 
later on 
to make sure).

>       seek() is not "tell me if this value exists", it's more of "move to the 
> first record with this value, or (optionally) the closest record to this 
> value without exceeding it".

I guess what I usually need it for is "tell me if this value exists", and if it 
does 
leave the pointer on that record.

>       Do you want the pointer to move? Or do you just want to test for the 
> existence of the value?

By default, move the pointer, but provide the option to not move the pointer as 
well.

>       What would you suggest for a name for this new behavior?

seek2()?

Just kidding, of course, but seek() is the perfect name...

Paul

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/[email protected]

Reply via email to