Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
a dictionary of ranges
#9
(Nov-30-2017, 04:52 AM)buran Wrote: Then start coding whatever you want.

this is one of those things i perceive as being too big/complex for me to do.  so i will use what other people have made or i will have nothing to use.

@Windspar

how does that handle overlapping ranges?  can it handle ranges between strings like ('bar','foo')?

i would also want to compare two ranges objects to know if they represent the same set of ranges (with the same value for each range) regardless of how different overlappings produce these ranges.

and much like a dictionary can produce an iterable, i want to have that.  while dict.items() would return an iterable of (key,value), ranges.items() would return an iterable of (from,to,value).  either of these can be sorted.

and adding 2 ranges that are exactly adjacent with the same value should (as seen in .items()) become a combined range.

oh, instead of (from,to,value) it could be (range,value).  there would be a range class that should be a simple class and then the ranges class that manges many.

then i will get more demanding and want 2D and 3D ranges.  or maybe more elaborate shapes.  imagine a class where i can merge a cube of 'purple' and a sphere of 'red' and a thing of green defined by a shape class object.
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,602 May-14-2023, 04:29 PM
Last Post: Winfried
  Delete all Excel named ranges (local and global scope) pfdjhfuys 2 1,895 Mar-24-2023, 01:32 PM
Last Post: pfdjhfuys
  Dictionary with ranges that have a float step value Irv1n 2 2,155 Apr-21-2021, 09:04 PM
Last Post: Yoriz
  Two operations in two ranges salwa17 3 2,249 Jun-22-2020, 04:15 PM
Last Post: perfringo
  iterating a list of ranges Skaperen 1 2,074 May-22-2019, 07:44 AM
Last Post: Gribouillis
  Subnet Mask Ranges ab52 0 1,850 Mar-11-2019, 10:39 AM
Last Post: ab52
  joined ranges Skaperen 4 3,259 Apr-03-2018, 07:14 PM
Last Post: Gribouillis
  compacting multiple ranges Skaperen 2 3,146 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