Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
a dictionary of ranges
#6
in English, the plural form of range is ranges.  i'm looking for a class that supports more than one range.  an instance of such a class should start empty and have a default value (can be specified or be None if not specified).  i then add range 2,3.5 to have a value of 'foo'.  i then add range 4.5,6 to have a value of 'bar'.  i then lookup 4.75 and get 'bar'.  i then delete range 3,5.  i repeat lookup 4.75 and now i get the default value.  so delete is just a case of adding a range of the default value.  this is a "flat" range container.

a "stack" range container would return a list of values based on the inserts being stacked over and the lookup seeing the stack.  so in the above i would get [None, 'bar', None].  a special smash function would mash down everything in the range specified so that if range 3,5 is smashed (a true delete) then looking up 4.75 returns [None].

there would also be network address variants of those that can be optimized and support high speed route tables.

maybe these have already been done?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Messages In This Thread
a dictionary of ranges - by Skaperen - Nov-29-2017, 01:53 AM
RE: a dictionary of ranges - by Windspar - Nov-29-2017, 01:45 PM
RE: a dictionary of ranges - by buran - Nov-29-2017, 02:47 PM
RE: a dictionary of ranges - by Windspar - Nov-29-2017, 04:13 PM
RE: a dictionary of ranges - by Windspar - Nov-29-2017, 09:23 PM
RE: a dictionary of ranges - by Skaperen - Nov-30-2017, 02:17 AM
RE: a dictionary of ranges - by buran - Nov-30-2017, 04:52 AM
RE: a dictionary of ranges - by Skaperen - Dec-01-2017, 04:10 AM
RE: a dictionary of ranges - by Windspar - Nov-30-2017, 05:56 PM
RE: a dictionary of ranges - by Windspar - Dec-02-2017, 07:40 PM
RE: a dictionary of ranges - by Windspar - Dec-02-2017, 11:29 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [SOLVED] [loop] Exclude ranges in… range? Winfried 2 1,665 May-14-2023, 04:29 PM
Last Post: Winfried
  Delete all Excel named ranges (local and global scope) pfdjhfuys 2 2,022 Mar-24-2023, 01:32 PM
Last Post: pfdjhfuys
  Dictionary with ranges that have a float step value Irv1n 2 2,197 Apr-21-2021, 09:04 PM
Last Post: Yoriz
  Two operations in two ranges salwa17 3 2,267 Jun-22-2020, 04:15 PM
Last Post: perfringo
  iterating a list of ranges Skaperen 1 2,091 May-22-2019, 07:44 AM
Last Post: Gribouillis
  Subnet Mask Ranges ab52 0 1,867 Mar-11-2019, 10:39 AM
Last Post: ab52
  joined ranges Skaperen 4 3,286 Apr-03-2018, 07:14 PM
Last Post: Gribouillis
  compacting multiple ranges Skaperen 2 3,168 Oct-11-2017, 08:33 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020