On Mar 26, 11:02 pm, Paul Rubin <http://phr...@nospam.invalid> wrote:
> Dennis Lee Bieber <wlfr...@ix.netcom.com> writes:
>
> > ...        v = theDict.get(x, NOT_RELEVANT)
> > ...        if v is not NOT_RELEVANT:
> > ...                print x, v
>
> I think you'd normally do this with
>
>      if x in theDict:
>           print x, v

Where does v come from?

> but the OP was asking about a different problem, involving looking up
> numeric ranges, which could conceivably be very large, thus the
> suggestions about interval trees and so forth.

The fact that the OP asked about what to do with the the other 65526
values suggests that he only wanted to use intervals to fill in the
gaps between meaningful values (thus having complete coverage over the
16-bit integer range).  An interval tree would not be a good approach
for that situation.


Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to