Python “triplet” dictionary?How to merge two dictionaries in a single expression?Calling an external command in PythonWhat are metaclasses in Python?How can I safely create a nested directory in Python?Does Python have a ternary conditional operator?How do I sort a dictionary by value?Add new keys to a dictionary?Check if a given key already exists in a dictionaryIterating over dictionaries using 'for' loopsDoes Python have a string 'contains' substring method?

shebang or not shebang

Is there a reason why Turkey took the Balkan territories of the Ottoman Empire, instead of Greece or another of the Balkan states?

Does this website provide consistent translation into Wookiee?

Learning how to read schematics, questions about fractional voltage in schematic

What is the Ancient One's mistake?

How do I minimise waste on a flight?

Why doesn't a particle exert force on itself?

Appropriate age to involve kids in life changing decisions

How to make a kid's bike easier to pedal

How can I finally understand the confusing modal verb "мочь"?

Why was Gemini VIII terminated after recovering from the OAMS thruster failure?

While drilling into kitchen wall, hit a wire - any advice?

Why always 4...dxc6 and not 4...bxc6 in the Ruy Lopez Exchange?

LiOH hydrolysis of methyl 2,2-dimethoxyacetate not giving product?

How does "politician" work as a job/career?

Bash prompt takes only the first word of a hostname before the dot

Scaling rounded rectangles in Illustrator

What is more safe for browsing the web: PC or smartphone?

What did Varys actually mean?

What calendar would the Saturn nation use?

Does restarting the SQL Services (on the machine) clear the server cache (for things like query plans and statistics)?

What does “two-bit (jerk)” mean?

What does the copyright in a dissertation protect exactly?

How could a humanoid creature completely form within the span of 24 hours?



Python “triplet” dictionary?


How to merge two dictionaries in a single expression?Calling an external command in PythonWhat are metaclasses in Python?How can I safely create a nested directory in Python?Does Python have a ternary conditional operator?How do I sort a dictionary by value?Add new keys to a dictionary?Check if a given key already exists in a dictionaryIterating over dictionaries using 'for' loopsDoes Python have a string 'contains' substring method?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








15















If we have (a1, b1) and (a2, b2) it's easy to use a dictionary to store the correspondences:



dict[a1] = b1
dict[a2] = b2


And we can get (a1, b1) and (a2, b2) back no problem.



But, if we have (a1, b1, c1) and (a2, b2, c2), is it possible to get something like:



dict[a1] = (b1, c1)
dict[b1] = (a1, c1)


Where we can use either a1 or b1 to get the triplet (a1, b1, c2) back? Does that make sense? I'm not quite sure which datatype to use for this problem. The above would work but there would be duplicate data.



Basically, if I have a triplet, which data type could I use such that I can use either the first or second value to get the triplet back?










share|improve this question

















  • 1





    You want to be able to recover the triplet from any of the elements?

    – Olivier Melançon
    Apr 28 at 16:59






  • 1





    perfect time to learn how to make your own data types. see docs.python.org/3/library/stdtypes.html#typesmapping

    – user633183
    Apr 28 at 17:03







  • 2





    Quick hint: you would either need a custom mapping type (e.g. a dict subclass with __getitem__ overridden, at the very least) or you would need some custom container type that can wrap each item of your tuples and the tuples themselves such that they have the same __hash__. I suspect you might have an X-Y problem though but hard to be sure.

    – Iguananaut
    Apr 28 at 17:05






  • 6





    I think it's an interesting problem. The answers given below are the most obvious but if you wanted to completely avoid duplication you'd have to do some tricks with hashes. I have to say, while it's a neat idea, in 25 years of programming I have never needed a data structure quite like this which is why I suspect an X-Y problem, but who knows stranger things have happened.

    – Iguananaut
    Apr 28 at 17:25






  • 1





    Apparently, this type of question needs a basic relational database as been pointed out here codereview.stackexchange.com/q/85842/127240 Consider using sqlite module for that. This is basically SELECT * FROM table_foo WHERE b_value = 'b1'; which would probably be the same as SELECT * FROM table_foo WHERE a_value = 'a1'; And if I'm not mistaken a1 and b1 would be composite key for c1

    – Sergiy Kolodyazhnyy
    Apr 29 at 4:37


















15















If we have (a1, b1) and (a2, b2) it's easy to use a dictionary to store the correspondences:



dict[a1] = b1
dict[a2] = b2


And we can get (a1, b1) and (a2, b2) back no problem.



But, if we have (a1, b1, c1) and (a2, b2, c2), is it possible to get something like:



dict[a1] = (b1, c1)
dict[b1] = (a1, c1)


Where we can use either a1 or b1 to get the triplet (a1, b1, c2) back? Does that make sense? I'm not quite sure which datatype to use for this problem. The above would work but there would be duplicate data.



Basically, if I have a triplet, which data type could I use such that I can use either the first or second value to get the triplet back?










share|improve this question

















  • 1





    You want to be able to recover the triplet from any of the elements?

    – Olivier Melançon
    Apr 28 at 16:59






  • 1





    perfect time to learn how to make your own data types. see docs.python.org/3/library/stdtypes.html#typesmapping

    – user633183
    Apr 28 at 17:03







  • 2





    Quick hint: you would either need a custom mapping type (e.g. a dict subclass with __getitem__ overridden, at the very least) or you would need some custom container type that can wrap each item of your tuples and the tuples themselves such that they have the same __hash__. I suspect you might have an X-Y problem though but hard to be sure.

    – Iguananaut
    Apr 28 at 17:05






  • 6





    I think it's an interesting problem. The answers given below are the most obvious but if you wanted to completely avoid duplication you'd have to do some tricks with hashes. I have to say, while it's a neat idea, in 25 years of programming I have never needed a data structure quite like this which is why I suspect an X-Y problem, but who knows stranger things have happened.

    – Iguananaut
    Apr 28 at 17:25






  • 1





    Apparently, this type of question needs a basic relational database as been pointed out here codereview.stackexchange.com/q/85842/127240 Consider using sqlite module for that. This is basically SELECT * FROM table_foo WHERE b_value = 'b1'; which would probably be the same as SELECT * FROM table_foo WHERE a_value = 'a1'; And if I'm not mistaken a1 and b1 would be composite key for c1

    – Sergiy Kolodyazhnyy
    Apr 29 at 4:37














15












15








15


2






If we have (a1, b1) and (a2, b2) it's easy to use a dictionary to store the correspondences:



dict[a1] = b1
dict[a2] = b2


And we can get (a1, b1) and (a2, b2) back no problem.



But, if we have (a1, b1, c1) and (a2, b2, c2), is it possible to get something like:



dict[a1] = (b1, c1)
dict[b1] = (a1, c1)


Where we can use either a1 or b1 to get the triplet (a1, b1, c2) back? Does that make sense? I'm not quite sure which datatype to use for this problem. The above would work but there would be duplicate data.



Basically, if I have a triplet, which data type could I use such that I can use either the first or second value to get the triplet back?










share|improve this question














If we have (a1, b1) and (a2, b2) it's easy to use a dictionary to store the correspondences:



dict[a1] = b1
dict[a2] = b2


And we can get (a1, b1) and (a2, b2) back no problem.



But, if we have (a1, b1, c1) and (a2, b2, c2), is it possible to get something like:



dict[a1] = (b1, c1)
dict[b1] = (a1, c1)


Where we can use either a1 or b1 to get the triplet (a1, b1, c2) back? Does that make sense? I'm not quite sure which datatype to use for this problem. The above would work but there would be duplicate data.



Basically, if I have a triplet, which data type could I use such that I can use either the first or second value to get the triplet back?







python






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Apr 28 at 16:58









JustinJustin

3,30922550




3,30922550







  • 1





    You want to be able to recover the triplet from any of the elements?

    – Olivier Melançon
    Apr 28 at 16:59






  • 1





    perfect time to learn how to make your own data types. see docs.python.org/3/library/stdtypes.html#typesmapping

    – user633183
    Apr 28 at 17:03







  • 2





    Quick hint: you would either need a custom mapping type (e.g. a dict subclass with __getitem__ overridden, at the very least) or you would need some custom container type that can wrap each item of your tuples and the tuples themselves such that they have the same __hash__. I suspect you might have an X-Y problem though but hard to be sure.

    – Iguananaut
    Apr 28 at 17:05






  • 6





    I think it's an interesting problem. The answers given below are the most obvious but if you wanted to completely avoid duplication you'd have to do some tricks with hashes. I have to say, while it's a neat idea, in 25 years of programming I have never needed a data structure quite like this which is why I suspect an X-Y problem, but who knows stranger things have happened.

    – Iguananaut
    Apr 28 at 17:25






  • 1





    Apparently, this type of question needs a basic relational database as been pointed out here codereview.stackexchange.com/q/85842/127240 Consider using sqlite module for that. This is basically SELECT * FROM table_foo WHERE b_value = 'b1'; which would probably be the same as SELECT * FROM table_foo WHERE a_value = 'a1'; And if I'm not mistaken a1 and b1 would be composite key for c1

    – Sergiy Kolodyazhnyy
    Apr 29 at 4:37













  • 1





    You want to be able to recover the triplet from any of the elements?

    – Olivier Melançon
    Apr 28 at 16:59






  • 1





    perfect time to learn how to make your own data types. see docs.python.org/3/library/stdtypes.html#typesmapping

    – user633183
    Apr 28 at 17:03







  • 2





    Quick hint: you would either need a custom mapping type (e.g. a dict subclass with __getitem__ overridden, at the very least) or you would need some custom container type that can wrap each item of your tuples and the tuples themselves such that they have the same __hash__. I suspect you might have an X-Y problem though but hard to be sure.

    – Iguananaut
    Apr 28 at 17:05






  • 6





    I think it's an interesting problem. The answers given below are the most obvious but if you wanted to completely avoid duplication you'd have to do some tricks with hashes. I have to say, while it's a neat idea, in 25 years of programming I have never needed a data structure quite like this which is why I suspect an X-Y problem, but who knows stranger things have happened.

    – Iguananaut
    Apr 28 at 17:25






  • 1





    Apparently, this type of question needs a basic relational database as been pointed out here codereview.stackexchange.com/q/85842/127240 Consider using sqlite module for that. This is basically SELECT * FROM table_foo WHERE b_value = 'b1'; which would probably be the same as SELECT * FROM table_foo WHERE a_value = 'a1'; And if I'm not mistaken a1 and b1 would be composite key for c1

    – Sergiy Kolodyazhnyy
    Apr 29 at 4:37








1




1





You want to be able to recover the triplet from any of the elements?

– Olivier Melançon
Apr 28 at 16:59





You want to be able to recover the triplet from any of the elements?

– Olivier Melançon
Apr 28 at 16:59




1




1





perfect time to learn how to make your own data types. see docs.python.org/3/library/stdtypes.html#typesmapping

– user633183
Apr 28 at 17:03






perfect time to learn how to make your own data types. see docs.python.org/3/library/stdtypes.html#typesmapping

– user633183
Apr 28 at 17:03





2




2





Quick hint: you would either need a custom mapping type (e.g. a dict subclass with __getitem__ overridden, at the very least) or you would need some custom container type that can wrap each item of your tuples and the tuples themselves such that they have the same __hash__. I suspect you might have an X-Y problem though but hard to be sure.

– Iguananaut
Apr 28 at 17:05





Quick hint: you would either need a custom mapping type (e.g. a dict subclass with __getitem__ overridden, at the very least) or you would need some custom container type that can wrap each item of your tuples and the tuples themselves such that they have the same __hash__. I suspect you might have an X-Y problem though but hard to be sure.

– Iguananaut
Apr 28 at 17:05




6




6





I think it's an interesting problem. The answers given below are the most obvious but if you wanted to completely avoid duplication you'd have to do some tricks with hashes. I have to say, while it's a neat idea, in 25 years of programming I have never needed a data structure quite like this which is why I suspect an X-Y problem, but who knows stranger things have happened.

– Iguananaut
Apr 28 at 17:25





I think it's an interesting problem. The answers given below are the most obvious but if you wanted to completely avoid duplication you'd have to do some tricks with hashes. I have to say, while it's a neat idea, in 25 years of programming I have never needed a data structure quite like this which is why I suspect an X-Y problem, but who knows stranger things have happened.

– Iguananaut
Apr 28 at 17:25




1




1





Apparently, this type of question needs a basic relational database as been pointed out here codereview.stackexchange.com/q/85842/127240 Consider using sqlite module for that. This is basically SELECT * FROM table_foo WHERE b_value = 'b1'; which would probably be the same as SELECT * FROM table_foo WHERE a_value = 'a1'; And if I'm not mistaken a1 and b1 would be composite key for c1

– Sergiy Kolodyazhnyy
Apr 29 at 4:37






Apparently, this type of question needs a basic relational database as been pointed out here codereview.stackexchange.com/q/85842/127240 Consider using sqlite module for that. This is basically SELECT * FROM table_foo WHERE b_value = 'b1'; which would probably be the same as SELECT * FROM table_foo WHERE a_value = 'a1'; And if I'm not mistaken a1 and b1 would be composite key for c1

– Sergiy Kolodyazhnyy
Apr 29 at 4:37













5 Answers
5






active

oldest

votes


















10














Solution



You can write your own mapping data-structure which allows to add triples, or groups of any size, and recover the group with __getitem__.



class GroupMap:
def __init__(self):
self.data =

def add(self, group):
for item in group:
self.data[item] = group

def __getitem__(self, item):
return self.data[item]

group = (1, 2, 3)
group_map = GroupMap()

group_map.add(group)

print(group_map[1]) # (1, 2, 3)


Notice that this GroupMap can be used for groups of any size, not only triples.



The next step in the above would be to extend the class to avoid collisions according to the behaviour you want when a collision occurs.



Theory



You might wonder if there is a better way to represent groups of connected objects. The answer is not really.



Suppose you have a graph containing n vertices. Then for the graph to be connected, you must have at least n - 1 edges. In the above data-structure, I used n entry in the dict, meaning the solution is nearly optimal.



Why not use n - 1 entries if it can be done? Because you would then need to traverse all your graph to recover the whole group. Thus using one more edge allows for O(1) lookup, which is a trade-off you probably want to take.






share|improve this answer

























  • Wouldn't this still duplicate the information in the same way?

    – MyNameIsCaleb
    Apr 28 at 17:09






  • 1





    @GiraffeMan91 Yes, but there is no other way. A connexion between two items must be stored one way of another. Another way to visualize this is that a graph of n items must have at least (n-1) vertices to be connected. Here I use two more than that, but this is to allow fast lookup.

    – Olivier Melançon
    Apr 28 at 17:12












  • Yea I understand I just wanted to be clear that we agreed. I thought the primary element of the question was to reduce duplication which I don't believe can be done either, I just thought your answer turned what the post already said they could do into a class with methods, which is written nicely, but I felt the post already explained they knew how to do what your answer provided and they were looking for other methods.

    – MyNameIsCaleb
    Apr 28 at 17:22











  • @GiraffeMan91 Fair point, I edited the answer to explain why we cannot do better than that.

    – Olivier Melançon
    Apr 28 at 17:26






  • 1





    @GiraffeMan91 The problem I see with traversal is that it requires implementing some kind of graph data-structure which 1) slows down everything and 2) is a bit overly complex in my opinion for what we want to achieve.

    – Olivier Melançon
    Apr 28 at 17:33


















2














An alternative if you want to subclass dict (to get all other methods associated with dict like .get and whatnot) and only get the other elements when asked (for some reason). You can make a new dictionary that is all your own



class TupleDict(dict):

def __setitem__(self, key, value):
assert isinstance(key, tuple)
for i, e in enumerate(key):
dict.__setitem__(self, e, key[:i] + key[i+1:] + (value,))
dict.__setitem__(self, value, key)


and then assign any key that is a tuple to a single value (not sure I like this syntax, but we can make it different or use a stand-alone method)



d = TriDict()
d[(1,2)] = 4


and you will have the result of __getitem__ return the rest of the tuple not present.



>>> print(d[1])
(2, 4)
>>> print(d[2])
(1, 4)
print(d[4])
>>> (1, 2)





share|improve this answer
































    1














    Building on Olivier Melançons answer, I came up with this - in case the position of the value in the tuple matters:



    class GroupMap:
    def __init__(self, data=None):
    self.data =
    if data:
    self.add(data)

    def add(self, data):
    for idx, key in enumerate(data):
    self.data.setdefault(idx, )[key] = data

    def __getitem__(self, key):
    # lookup in first index
    return self.getby(0, key)

    def getby(self, idx, key):
    return self.data[idx].get(key)


    data = ('a', 'b', 'c')
    g = GroupMap(data)
    more_data = ('b', 'a', 'z')
    g.add(more_data)

    assert g['a'] == data

    assert g.getby(0, 'a') == data
    assert g.getby(0, 'b') == more_data
    assert g.getby(0, 'c') is None

    assert g.getby(1, 'a') == more_data
    assert g.getby(1, 'b') == data

    assert g.getby(2, 'c') == data
    assert g.getby(2, 'z') == more_data

    assert id(data) == id(g['a']) == id(g.getby(1, 'b'))





    share|improve this answer






























      0














      Dictionaries can store key value pairs only.



      You could make your own triplet dictionary however using operator overloading so that when you index with any member of the triplets you get back the other two, maybe something like this:



      class trictionary:
      def __init__(self):
      self.data = []

      def add(self, group):
      self.data.append(group)

      def __getitem__(self, key):
      for group in data: #Find the set the key belongs to.
      if key in group:
      return tuple(group)


      This avoids replicating the data and has the functionality you're looking for at the expense of performance. There may be a better way of doing the same.






      share|improve this answer


















      • 3





        I love "trictionary"

        – modesitt
        Apr 28 at 17:16












      • That was probably the part of my answer with the most merit...

        – Eden Trainor
        Apr 28 at 17:34


















      0














      Your question has examples that deviate from the main question:




      Basically, if I have a triplet, which data type could I use such that I can use either the first or second value to get the triplet back?




      A dict. Assign key-value pairs of element, triplet (see @Olivier Melançon's answer):



      Code



      d = 
      for x in triplet:
      d[x] = triplet


      Demo



      d["a"]
      # ('a', 'b', 'c')

      d["b"]
      # ('a', 'b', 'c')

      d["c"]
      # ('a', 'b', 'c')


      The OP requires clarity on preferred behavior in:



      • adding elements, e.g. d[a1] = (b1, c1) vs. f((a1, b1, c1))

      • element ordering, e.g. (a1, b1, c1) vs. (b1, a1, c1)

      • duplicate data, e.g. hold (a1, b1, c1) three times or combinations of 2-tuple subsets

      With these items addressed, more elaborate solutions are possible.






      share|improve this answer

























        Your Answer






        StackExchange.ifUsing("editor", function ()
        StackExchange.using("externalEditor", function ()
        StackExchange.using("snippets", function ()
        StackExchange.snippets.init();
        );
        );
        , "code-snippets");

        StackExchange.ready(function()
        var channelOptions =
        tags: "".split(" "),
        id: "1"
        ;
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function()
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled)
        StackExchange.using("snippets", function()
        createEditor();
        );

        else
        createEditor();

        );

        function createEditor()
        StackExchange.prepareEditor(
        heartbeatType: 'answer',
        autoActivateHeartbeat: false,
        convertImagesToLinks: true,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: 10,
        bindNavPrevention: true,
        postfix: "",
        imageUploader:
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        ,
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        );



        );













        draft saved

        draft discarded


















        StackExchange.ready(
        function ()
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55892600%2fpython-triplet-dictionary%23new-answer', 'question_page');

        );

        Post as a guest















        Required, but never shown

























        5 Answers
        5






        active

        oldest

        votes








        5 Answers
        5






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        10














        Solution



        You can write your own mapping data-structure which allows to add triples, or groups of any size, and recover the group with __getitem__.



        class GroupMap:
        def __init__(self):
        self.data =

        def add(self, group):
        for item in group:
        self.data[item] = group

        def __getitem__(self, item):
        return self.data[item]

        group = (1, 2, 3)
        group_map = GroupMap()

        group_map.add(group)

        print(group_map[1]) # (1, 2, 3)


        Notice that this GroupMap can be used for groups of any size, not only triples.



        The next step in the above would be to extend the class to avoid collisions according to the behaviour you want when a collision occurs.



        Theory



        You might wonder if there is a better way to represent groups of connected objects. The answer is not really.



        Suppose you have a graph containing n vertices. Then for the graph to be connected, you must have at least n - 1 edges. In the above data-structure, I used n entry in the dict, meaning the solution is nearly optimal.



        Why not use n - 1 entries if it can be done? Because you would then need to traverse all your graph to recover the whole group. Thus using one more edge allows for O(1) lookup, which is a trade-off you probably want to take.






        share|improve this answer

























        • Wouldn't this still duplicate the information in the same way?

          – MyNameIsCaleb
          Apr 28 at 17:09






        • 1





          @GiraffeMan91 Yes, but there is no other way. A connexion between two items must be stored one way of another. Another way to visualize this is that a graph of n items must have at least (n-1) vertices to be connected. Here I use two more than that, but this is to allow fast lookup.

          – Olivier Melançon
          Apr 28 at 17:12












        • Yea I understand I just wanted to be clear that we agreed. I thought the primary element of the question was to reduce duplication which I don't believe can be done either, I just thought your answer turned what the post already said they could do into a class with methods, which is written nicely, but I felt the post already explained they knew how to do what your answer provided and they were looking for other methods.

          – MyNameIsCaleb
          Apr 28 at 17:22











        • @GiraffeMan91 Fair point, I edited the answer to explain why we cannot do better than that.

          – Olivier Melançon
          Apr 28 at 17:26






        • 1





          @GiraffeMan91 The problem I see with traversal is that it requires implementing some kind of graph data-structure which 1) slows down everything and 2) is a bit overly complex in my opinion for what we want to achieve.

          – Olivier Melançon
          Apr 28 at 17:33















        10














        Solution



        You can write your own mapping data-structure which allows to add triples, or groups of any size, and recover the group with __getitem__.



        class GroupMap:
        def __init__(self):
        self.data =

        def add(self, group):
        for item in group:
        self.data[item] = group

        def __getitem__(self, item):
        return self.data[item]

        group = (1, 2, 3)
        group_map = GroupMap()

        group_map.add(group)

        print(group_map[1]) # (1, 2, 3)


        Notice that this GroupMap can be used for groups of any size, not only triples.



        The next step in the above would be to extend the class to avoid collisions according to the behaviour you want when a collision occurs.



        Theory



        You might wonder if there is a better way to represent groups of connected objects. The answer is not really.



        Suppose you have a graph containing n vertices. Then for the graph to be connected, you must have at least n - 1 edges. In the above data-structure, I used n entry in the dict, meaning the solution is nearly optimal.



        Why not use n - 1 entries if it can be done? Because you would then need to traverse all your graph to recover the whole group. Thus using one more edge allows for O(1) lookup, which is a trade-off you probably want to take.






        share|improve this answer

























        • Wouldn't this still duplicate the information in the same way?

          – MyNameIsCaleb
          Apr 28 at 17:09






        • 1





          @GiraffeMan91 Yes, but there is no other way. A connexion between two items must be stored one way of another. Another way to visualize this is that a graph of n items must have at least (n-1) vertices to be connected. Here I use two more than that, but this is to allow fast lookup.

          – Olivier Melançon
          Apr 28 at 17:12












        • Yea I understand I just wanted to be clear that we agreed. I thought the primary element of the question was to reduce duplication which I don't believe can be done either, I just thought your answer turned what the post already said they could do into a class with methods, which is written nicely, but I felt the post already explained they knew how to do what your answer provided and they were looking for other methods.

          – MyNameIsCaleb
          Apr 28 at 17:22











        • @GiraffeMan91 Fair point, I edited the answer to explain why we cannot do better than that.

          – Olivier Melançon
          Apr 28 at 17:26






        • 1





          @GiraffeMan91 The problem I see with traversal is that it requires implementing some kind of graph data-structure which 1) slows down everything and 2) is a bit overly complex in my opinion for what we want to achieve.

          – Olivier Melançon
          Apr 28 at 17:33













        10












        10








        10







        Solution



        You can write your own mapping data-structure which allows to add triples, or groups of any size, and recover the group with __getitem__.



        class GroupMap:
        def __init__(self):
        self.data =

        def add(self, group):
        for item in group:
        self.data[item] = group

        def __getitem__(self, item):
        return self.data[item]

        group = (1, 2, 3)
        group_map = GroupMap()

        group_map.add(group)

        print(group_map[1]) # (1, 2, 3)


        Notice that this GroupMap can be used for groups of any size, not only triples.



        The next step in the above would be to extend the class to avoid collisions according to the behaviour you want when a collision occurs.



        Theory



        You might wonder if there is a better way to represent groups of connected objects. The answer is not really.



        Suppose you have a graph containing n vertices. Then for the graph to be connected, you must have at least n - 1 edges. In the above data-structure, I used n entry in the dict, meaning the solution is nearly optimal.



        Why not use n - 1 entries if it can be done? Because you would then need to traverse all your graph to recover the whole group. Thus using one more edge allows for O(1) lookup, which is a trade-off you probably want to take.






        share|improve this answer















        Solution



        You can write your own mapping data-structure which allows to add triples, or groups of any size, and recover the group with __getitem__.



        class GroupMap:
        def __init__(self):
        self.data =

        def add(self, group):
        for item in group:
        self.data[item] = group

        def __getitem__(self, item):
        return self.data[item]

        group = (1, 2, 3)
        group_map = GroupMap()

        group_map.add(group)

        print(group_map[1]) # (1, 2, 3)


        Notice that this GroupMap can be used for groups of any size, not only triples.



        The next step in the above would be to extend the class to avoid collisions according to the behaviour you want when a collision occurs.



        Theory



        You might wonder if there is a better way to represent groups of connected objects. The answer is not really.



        Suppose you have a graph containing n vertices. Then for the graph to be connected, you must have at least n - 1 edges. In the above data-structure, I used n entry in the dict, meaning the solution is nearly optimal.



        Why not use n - 1 entries if it can be done? Because you would then need to traverse all your graph to recover the whole group. Thus using one more edge allows for O(1) lookup, which is a trade-off you probably want to take.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Apr 28 at 17:36

























        answered Apr 28 at 17:07









        Olivier MelançonOlivier Melançon

        14.7k32144




        14.7k32144












        • Wouldn't this still duplicate the information in the same way?

          – MyNameIsCaleb
          Apr 28 at 17:09






        • 1





          @GiraffeMan91 Yes, but there is no other way. A connexion between two items must be stored one way of another. Another way to visualize this is that a graph of n items must have at least (n-1) vertices to be connected. Here I use two more than that, but this is to allow fast lookup.

          – Olivier Melançon
          Apr 28 at 17:12












        • Yea I understand I just wanted to be clear that we agreed. I thought the primary element of the question was to reduce duplication which I don't believe can be done either, I just thought your answer turned what the post already said they could do into a class with methods, which is written nicely, but I felt the post already explained they knew how to do what your answer provided and they were looking for other methods.

          – MyNameIsCaleb
          Apr 28 at 17:22











        • @GiraffeMan91 Fair point, I edited the answer to explain why we cannot do better than that.

          – Olivier Melançon
          Apr 28 at 17:26






        • 1





          @GiraffeMan91 The problem I see with traversal is that it requires implementing some kind of graph data-structure which 1) slows down everything and 2) is a bit overly complex in my opinion for what we want to achieve.

          – Olivier Melançon
          Apr 28 at 17:33

















        • Wouldn't this still duplicate the information in the same way?

          – MyNameIsCaleb
          Apr 28 at 17:09






        • 1





          @GiraffeMan91 Yes, but there is no other way. A connexion between two items must be stored one way of another. Another way to visualize this is that a graph of n items must have at least (n-1) vertices to be connected. Here I use two more than that, but this is to allow fast lookup.

          – Olivier Melançon
          Apr 28 at 17:12












        • Yea I understand I just wanted to be clear that we agreed. I thought the primary element of the question was to reduce duplication which I don't believe can be done either, I just thought your answer turned what the post already said they could do into a class with methods, which is written nicely, but I felt the post already explained they knew how to do what your answer provided and they were looking for other methods.

          – MyNameIsCaleb
          Apr 28 at 17:22











        • @GiraffeMan91 Fair point, I edited the answer to explain why we cannot do better than that.

          – Olivier Melançon
          Apr 28 at 17:26






        • 1





          @GiraffeMan91 The problem I see with traversal is that it requires implementing some kind of graph data-structure which 1) slows down everything and 2) is a bit overly complex in my opinion for what we want to achieve.

          – Olivier Melançon
          Apr 28 at 17:33
















        Wouldn't this still duplicate the information in the same way?

        – MyNameIsCaleb
        Apr 28 at 17:09





        Wouldn't this still duplicate the information in the same way?

        – MyNameIsCaleb
        Apr 28 at 17:09




        1




        1





        @GiraffeMan91 Yes, but there is no other way. A connexion between two items must be stored one way of another. Another way to visualize this is that a graph of n items must have at least (n-1) vertices to be connected. Here I use two more than that, but this is to allow fast lookup.

        – Olivier Melançon
        Apr 28 at 17:12






        @GiraffeMan91 Yes, but there is no other way. A connexion between two items must be stored one way of another. Another way to visualize this is that a graph of n items must have at least (n-1) vertices to be connected. Here I use two more than that, but this is to allow fast lookup.

        – Olivier Melançon
        Apr 28 at 17:12














        Yea I understand I just wanted to be clear that we agreed. I thought the primary element of the question was to reduce duplication which I don't believe can be done either, I just thought your answer turned what the post already said they could do into a class with methods, which is written nicely, but I felt the post already explained they knew how to do what your answer provided and they were looking for other methods.

        – MyNameIsCaleb
        Apr 28 at 17:22





        Yea I understand I just wanted to be clear that we agreed. I thought the primary element of the question was to reduce duplication which I don't believe can be done either, I just thought your answer turned what the post already said they could do into a class with methods, which is written nicely, but I felt the post already explained they knew how to do what your answer provided and they were looking for other methods.

        – MyNameIsCaleb
        Apr 28 at 17:22













        @GiraffeMan91 Fair point, I edited the answer to explain why we cannot do better than that.

        – Olivier Melançon
        Apr 28 at 17:26





        @GiraffeMan91 Fair point, I edited the answer to explain why we cannot do better than that.

        – Olivier Melançon
        Apr 28 at 17:26




        1




        1





        @GiraffeMan91 The problem I see with traversal is that it requires implementing some kind of graph data-structure which 1) slows down everything and 2) is a bit overly complex in my opinion for what we want to achieve.

        – Olivier Melançon
        Apr 28 at 17:33





        @GiraffeMan91 The problem I see with traversal is that it requires implementing some kind of graph data-structure which 1) slows down everything and 2) is a bit overly complex in my opinion for what we want to achieve.

        – Olivier Melançon
        Apr 28 at 17:33













        2














        An alternative if you want to subclass dict (to get all other methods associated with dict like .get and whatnot) and only get the other elements when asked (for some reason). You can make a new dictionary that is all your own



        class TupleDict(dict):

        def __setitem__(self, key, value):
        assert isinstance(key, tuple)
        for i, e in enumerate(key):
        dict.__setitem__(self, e, key[:i] + key[i+1:] + (value,))
        dict.__setitem__(self, value, key)


        and then assign any key that is a tuple to a single value (not sure I like this syntax, but we can make it different or use a stand-alone method)



        d = TriDict()
        d[(1,2)] = 4


        and you will have the result of __getitem__ return the rest of the tuple not present.



        >>> print(d[1])
        (2, 4)
        >>> print(d[2])
        (1, 4)
        print(d[4])
        >>> (1, 2)





        share|improve this answer





























          2














          An alternative if you want to subclass dict (to get all other methods associated with dict like .get and whatnot) and only get the other elements when asked (for some reason). You can make a new dictionary that is all your own



          class TupleDict(dict):

          def __setitem__(self, key, value):
          assert isinstance(key, tuple)
          for i, e in enumerate(key):
          dict.__setitem__(self, e, key[:i] + key[i+1:] + (value,))
          dict.__setitem__(self, value, key)


          and then assign any key that is a tuple to a single value (not sure I like this syntax, but we can make it different or use a stand-alone method)



          d = TriDict()
          d[(1,2)] = 4


          and you will have the result of __getitem__ return the rest of the tuple not present.



          >>> print(d[1])
          (2, 4)
          >>> print(d[2])
          (1, 4)
          print(d[4])
          >>> (1, 2)





          share|improve this answer



























            2












            2








            2







            An alternative if you want to subclass dict (to get all other methods associated with dict like .get and whatnot) and only get the other elements when asked (for some reason). You can make a new dictionary that is all your own



            class TupleDict(dict):

            def __setitem__(self, key, value):
            assert isinstance(key, tuple)
            for i, e in enumerate(key):
            dict.__setitem__(self, e, key[:i] + key[i+1:] + (value,))
            dict.__setitem__(self, value, key)


            and then assign any key that is a tuple to a single value (not sure I like this syntax, but we can make it different or use a stand-alone method)



            d = TriDict()
            d[(1,2)] = 4


            and you will have the result of __getitem__ return the rest of the tuple not present.



            >>> print(d[1])
            (2, 4)
            >>> print(d[2])
            (1, 4)
            print(d[4])
            >>> (1, 2)





            share|improve this answer















            An alternative if you want to subclass dict (to get all other methods associated with dict like .get and whatnot) and only get the other elements when asked (for some reason). You can make a new dictionary that is all your own



            class TupleDict(dict):

            def __setitem__(self, key, value):
            assert isinstance(key, tuple)
            for i, e in enumerate(key):
            dict.__setitem__(self, e, key[:i] + key[i+1:] + (value,))
            dict.__setitem__(self, value, key)


            and then assign any key that is a tuple to a single value (not sure I like this syntax, but we can make it different or use a stand-alone method)



            d = TriDict()
            d[(1,2)] = 4


            and you will have the result of __getitem__ return the rest of the tuple not present.



            >>> print(d[1])
            (2, 4)
            >>> print(d[2])
            (1, 4)
            print(d[4])
            >>> (1, 2)






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Apr 28 at 17:26

























            answered Apr 28 at 17:11









            modesittmodesitt

            3,17721745




            3,17721745





















                1














                Building on Olivier Melançons answer, I came up with this - in case the position of the value in the tuple matters:



                class GroupMap:
                def __init__(self, data=None):
                self.data =
                if data:
                self.add(data)

                def add(self, data):
                for idx, key in enumerate(data):
                self.data.setdefault(idx, )[key] = data

                def __getitem__(self, key):
                # lookup in first index
                return self.getby(0, key)

                def getby(self, idx, key):
                return self.data[idx].get(key)


                data = ('a', 'b', 'c')
                g = GroupMap(data)
                more_data = ('b', 'a', 'z')
                g.add(more_data)

                assert g['a'] == data

                assert g.getby(0, 'a') == data
                assert g.getby(0, 'b') == more_data
                assert g.getby(0, 'c') is None

                assert g.getby(1, 'a') == more_data
                assert g.getby(1, 'b') == data

                assert g.getby(2, 'c') == data
                assert g.getby(2, 'z') == more_data

                assert id(data) == id(g['a']) == id(g.getby(1, 'b'))





                share|improve this answer



























                  1














                  Building on Olivier Melançons answer, I came up with this - in case the position of the value in the tuple matters:



                  class GroupMap:
                  def __init__(self, data=None):
                  self.data =
                  if data:
                  self.add(data)

                  def add(self, data):
                  for idx, key in enumerate(data):
                  self.data.setdefault(idx, )[key] = data

                  def __getitem__(self, key):
                  # lookup in first index
                  return self.getby(0, key)

                  def getby(self, idx, key):
                  return self.data[idx].get(key)


                  data = ('a', 'b', 'c')
                  g = GroupMap(data)
                  more_data = ('b', 'a', 'z')
                  g.add(more_data)

                  assert g['a'] == data

                  assert g.getby(0, 'a') == data
                  assert g.getby(0, 'b') == more_data
                  assert g.getby(0, 'c') is None

                  assert g.getby(1, 'a') == more_data
                  assert g.getby(1, 'b') == data

                  assert g.getby(2, 'c') == data
                  assert g.getby(2, 'z') == more_data

                  assert id(data) == id(g['a']) == id(g.getby(1, 'b'))





                  share|improve this answer

























                    1












                    1








                    1







                    Building on Olivier Melançons answer, I came up with this - in case the position of the value in the tuple matters:



                    class GroupMap:
                    def __init__(self, data=None):
                    self.data =
                    if data:
                    self.add(data)

                    def add(self, data):
                    for idx, key in enumerate(data):
                    self.data.setdefault(idx, )[key] = data

                    def __getitem__(self, key):
                    # lookup in first index
                    return self.getby(0, key)

                    def getby(self, idx, key):
                    return self.data[idx].get(key)


                    data = ('a', 'b', 'c')
                    g = GroupMap(data)
                    more_data = ('b', 'a', 'z')
                    g.add(more_data)

                    assert g['a'] == data

                    assert g.getby(0, 'a') == data
                    assert g.getby(0, 'b') == more_data
                    assert g.getby(0, 'c') is None

                    assert g.getby(1, 'a') == more_data
                    assert g.getby(1, 'b') == data

                    assert g.getby(2, 'c') == data
                    assert g.getby(2, 'z') == more_data

                    assert id(data) == id(g['a']) == id(g.getby(1, 'b'))





                    share|improve this answer













                    Building on Olivier Melançons answer, I came up with this - in case the position of the value in the tuple matters:



                    class GroupMap:
                    def __init__(self, data=None):
                    self.data =
                    if data:
                    self.add(data)

                    def add(self, data):
                    for idx, key in enumerate(data):
                    self.data.setdefault(idx, )[key] = data

                    def __getitem__(self, key):
                    # lookup in first index
                    return self.getby(0, key)

                    def getby(self, idx, key):
                    return self.data[idx].get(key)


                    data = ('a', 'b', 'c')
                    g = GroupMap(data)
                    more_data = ('b', 'a', 'z')
                    g.add(more_data)

                    assert g['a'] == data

                    assert g.getby(0, 'a') == data
                    assert g.getby(0, 'b') == more_data
                    assert g.getby(0, 'c') is None

                    assert g.getby(1, 'a') == more_data
                    assert g.getby(1, 'b') == data

                    assert g.getby(2, 'c') == data
                    assert g.getby(2, 'z') == more_data

                    assert id(data) == id(g['a']) == id(g.getby(1, 'b'))






                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Apr 28 at 18:40









                    CloudomationCloudomation

                    1,0101111




                    1,0101111





















                        0














                        Dictionaries can store key value pairs only.



                        You could make your own triplet dictionary however using operator overloading so that when you index with any member of the triplets you get back the other two, maybe something like this:



                        class trictionary:
                        def __init__(self):
                        self.data = []

                        def add(self, group):
                        self.data.append(group)

                        def __getitem__(self, key):
                        for group in data: #Find the set the key belongs to.
                        if key in group:
                        return tuple(group)


                        This avoids replicating the data and has the functionality you're looking for at the expense of performance. There may be a better way of doing the same.






                        share|improve this answer


















                        • 3





                          I love "trictionary"

                          – modesitt
                          Apr 28 at 17:16












                        • That was probably the part of my answer with the most merit...

                          – Eden Trainor
                          Apr 28 at 17:34















                        0














                        Dictionaries can store key value pairs only.



                        You could make your own triplet dictionary however using operator overloading so that when you index with any member of the triplets you get back the other two, maybe something like this:



                        class trictionary:
                        def __init__(self):
                        self.data = []

                        def add(self, group):
                        self.data.append(group)

                        def __getitem__(self, key):
                        for group in data: #Find the set the key belongs to.
                        if key in group:
                        return tuple(group)


                        This avoids replicating the data and has the functionality you're looking for at the expense of performance. There may be a better way of doing the same.






                        share|improve this answer


















                        • 3





                          I love "trictionary"

                          – modesitt
                          Apr 28 at 17:16












                        • That was probably the part of my answer with the most merit...

                          – Eden Trainor
                          Apr 28 at 17:34













                        0












                        0








                        0







                        Dictionaries can store key value pairs only.



                        You could make your own triplet dictionary however using operator overloading so that when you index with any member of the triplets you get back the other two, maybe something like this:



                        class trictionary:
                        def __init__(self):
                        self.data = []

                        def add(self, group):
                        self.data.append(group)

                        def __getitem__(self, key):
                        for group in data: #Find the set the key belongs to.
                        if key in group:
                        return tuple(group)


                        This avoids replicating the data and has the functionality you're looking for at the expense of performance. There may be a better way of doing the same.






                        share|improve this answer













                        Dictionaries can store key value pairs only.



                        You could make your own triplet dictionary however using operator overloading so that when you index with any member of the triplets you get back the other two, maybe something like this:



                        class trictionary:
                        def __init__(self):
                        self.data = []

                        def add(self, group):
                        self.data.append(group)

                        def __getitem__(self, key):
                        for group in data: #Find the set the key belongs to.
                        if key in group:
                        return tuple(group)


                        This avoids replicating the data and has the functionality you're looking for at the expense of performance. There may be a better way of doing the same.







                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered Apr 28 at 17:16









                        Eden TrainorEden Trainor

                        246




                        246







                        • 3





                          I love "trictionary"

                          – modesitt
                          Apr 28 at 17:16












                        • That was probably the part of my answer with the most merit...

                          – Eden Trainor
                          Apr 28 at 17:34












                        • 3





                          I love "trictionary"

                          – modesitt
                          Apr 28 at 17:16












                        • That was probably the part of my answer with the most merit...

                          – Eden Trainor
                          Apr 28 at 17:34







                        3




                        3





                        I love "trictionary"

                        – modesitt
                        Apr 28 at 17:16






                        I love "trictionary"

                        – modesitt
                        Apr 28 at 17:16














                        That was probably the part of my answer with the most merit...

                        – Eden Trainor
                        Apr 28 at 17:34





                        That was probably the part of my answer with the most merit...

                        – Eden Trainor
                        Apr 28 at 17:34











                        0














                        Your question has examples that deviate from the main question:




                        Basically, if I have a triplet, which data type could I use such that I can use either the first or second value to get the triplet back?




                        A dict. Assign key-value pairs of element, triplet (see @Olivier Melançon's answer):



                        Code



                        d = 
                        for x in triplet:
                        d[x] = triplet


                        Demo



                        d["a"]
                        # ('a', 'b', 'c')

                        d["b"]
                        # ('a', 'b', 'c')

                        d["c"]
                        # ('a', 'b', 'c')


                        The OP requires clarity on preferred behavior in:



                        • adding elements, e.g. d[a1] = (b1, c1) vs. f((a1, b1, c1))

                        • element ordering, e.g. (a1, b1, c1) vs. (b1, a1, c1)

                        • duplicate data, e.g. hold (a1, b1, c1) three times or combinations of 2-tuple subsets

                        With these items addressed, more elaborate solutions are possible.






                        share|improve this answer





























                          0














                          Your question has examples that deviate from the main question:




                          Basically, if I have a triplet, which data type could I use such that I can use either the first or second value to get the triplet back?




                          A dict. Assign key-value pairs of element, triplet (see @Olivier Melançon's answer):



                          Code



                          d = 
                          for x in triplet:
                          d[x] = triplet


                          Demo



                          d["a"]
                          # ('a', 'b', 'c')

                          d["b"]
                          # ('a', 'b', 'c')

                          d["c"]
                          # ('a', 'b', 'c')


                          The OP requires clarity on preferred behavior in:



                          • adding elements, e.g. d[a1] = (b1, c1) vs. f((a1, b1, c1))

                          • element ordering, e.g. (a1, b1, c1) vs. (b1, a1, c1)

                          • duplicate data, e.g. hold (a1, b1, c1) three times or combinations of 2-tuple subsets

                          With these items addressed, more elaborate solutions are possible.






                          share|improve this answer



























                            0












                            0








                            0







                            Your question has examples that deviate from the main question:




                            Basically, if I have a triplet, which data type could I use such that I can use either the first or second value to get the triplet back?




                            A dict. Assign key-value pairs of element, triplet (see @Olivier Melançon's answer):



                            Code



                            d = 
                            for x in triplet:
                            d[x] = triplet


                            Demo



                            d["a"]
                            # ('a', 'b', 'c')

                            d["b"]
                            # ('a', 'b', 'c')

                            d["c"]
                            # ('a', 'b', 'c')


                            The OP requires clarity on preferred behavior in:



                            • adding elements, e.g. d[a1] = (b1, c1) vs. f((a1, b1, c1))

                            • element ordering, e.g. (a1, b1, c1) vs. (b1, a1, c1)

                            • duplicate data, e.g. hold (a1, b1, c1) three times or combinations of 2-tuple subsets

                            With these items addressed, more elaborate solutions are possible.






                            share|improve this answer















                            Your question has examples that deviate from the main question:




                            Basically, if I have a triplet, which data type could I use such that I can use either the first or second value to get the triplet back?




                            A dict. Assign key-value pairs of element, triplet (see @Olivier Melançon's answer):



                            Code



                            d = 
                            for x in triplet:
                            d[x] = triplet


                            Demo



                            d["a"]
                            # ('a', 'b', 'c')

                            d["b"]
                            # ('a', 'b', 'c')

                            d["c"]
                            # ('a', 'b', 'c')


                            The OP requires clarity on preferred behavior in:



                            • adding elements, e.g. d[a1] = (b1, c1) vs. f((a1, b1, c1))

                            • element ordering, e.g. (a1, b1, c1) vs. (b1, a1, c1)

                            • duplicate data, e.g. hold (a1, b1, c1) three times or combinations of 2-tuple subsets

                            With these items addressed, more elaborate solutions are possible.







                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited Apr 29 at 18:27

























                            answered Apr 29 at 18:08









                            pylangpylang

                            14.8k24558




                            14.8k24558



























                                draft saved

                                draft discarded
















































                                Thanks for contributing an answer to Stack Overflow!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid


                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.

                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function ()
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55892600%2fpython-triplet-dictionary%23new-answer', 'question_page');

                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                Club Baloncesto Breogán Índice Historia | Pavillón | Nome | O Breogán na cultura popular | Xogadores | Adestradores | Presidentes | Palmarés | Historial | Líderes | Notas | Véxase tamén | Menú de navegacióncbbreogan.galCadroGuía oficial da ACB 2009-10, páxina 201Guía oficial ACB 1992, páxina 183. Editorial DB.É de 6.500 espectadores sentados axeitándose á última normativa"Estudiantes Junior, entre as mellores canteiras"o orixinalHemeroteca El Mundo Deportivo, 16 setembro de 1970, páxina 12Historia do BreogánAlfredo Pérez, o último canoneiroHistoria C.B. BreogánHemeroteca de El Mundo DeportivoJimmy Wright, norteamericano do Breogán deixará Lugo por ameazas de morteResultados de Breogán en 1986-87Resultados de Breogán en 1990-91Ficha de Velimir Perasović en acb.comResultados de Breogán en 1994-95Breogán arrasa al Barça. "El Mundo Deportivo", 27 de setembro de 1999, páxina 58CB Breogán - FC BarcelonaA FEB invita a participar nunha nova Liga EuropeaCharlie Bell na prensa estatalMáximos anotadores 2005Tempada 2005-06 : Tódolos Xogadores da Xornada""Non quero pensar nunha man negra, mais pregúntome que está a pasar""o orixinalRaúl López, orgulloso dos xogadores, presume da boa saúde económica do BreogánJulio González confirma que cesa como presidente del BreogánHomenaxe a Lisardo GómezA tempada do rexurdimento celesteEntrevista a Lisardo GómezEl COB dinamita el Pazo para forzar el quinto (69-73)Cafés Candelas, patrocinador del CB Breogán"Suso Lázare, novo presidente do Breogán"o orixinalCafés Candelas Breogán firma el mayor triunfo de la historiaEl Breogán realizará 17 homenajes por su cincuenta aniversario"O Breogán honra ao seu fundador e primeiro presidente"o orixinalMiguel Giao recibiu a homenaxe do PazoHomenaxe aos primeiros gladiadores celestesO home que nos amosa como ver o Breo co corazónTita Franco será homenaxeada polos #50anosdeBreoJulio Vila recibirá unha homenaxe in memoriam polos #50anosdeBreo"O Breogán homenaxeará aos seus aboados máis veteráns"Pechada ovación a «Capi» Sanmartín e Ricardo «Corazón de González»Homenaxe por décadas de informaciónPaco García volve ao Pazo con motivo do 50 aniversario"Resultados y clasificaciones""O Cafés Candelas Breogán, campión da Copa Princesa""O Cafés Candelas Breogán, equipo ACB"C.B. Breogán"Proxecto social"o orixinal"Centros asociados"o orixinalFicha en imdb.comMario Camus trata la recuperación del amor en 'La vieja música', su última película"Páxina web oficial""Club Baloncesto Breogán""C. B. Breogán S.A.D."eehttp://www.fegaba.com

                                Vilaño, A Laracha Índice Patrimonio | Lugares e parroquias | Véxase tamén | Menú de navegación43°14′52″N 8°36′03″O / 43.24775, -8.60070

                                Cegueira Índice Epidemioloxía | Deficiencia visual | Tipos de cegueira | Principais causas de cegueira | Tratamento | Técnicas de adaptación e axudas | Vida dos cegos | Primeiros auxilios | Crenzas respecto das persoas cegas | Crenzas das persoas cegas | O neno deficiente visual | Aspectos psicolóxicos da cegueira | Notas | Véxase tamén | Menú de navegación54.054.154.436928256blindnessDicionario da Real Academia GalegaPortal das Palabras"International Standards: Visual Standards — Aspects and Ranges of Vision Loss with Emphasis on Population Surveys.""Visual impairment and blindness""Presentan un plan para previr a cegueira"o orixinalACCDV Associació Catalana de Cecs i Disminuïts Visuals - PMFTrachoma"Effect of gene therapy on visual function in Leber's congenital amaurosis"1844137110.1056/NEJMoa0802268Cans guía - os mellores amigos dos cegosArquivadoEscola de cans guía para cegos en Mortágua, PortugalArquivado"Tecnología para ciegos y deficientes visuales. Recopilación de recursos gratuitos en la Red""Colorino""‘COL.diesis’, escuchar los sonidos del color""COL.diesis: Transforming Colour into Melody and Implementing the Result in a Colour Sensor Device"o orixinal"Sistema de desarrollo de sinestesia color-sonido para invidentes utilizando un protocolo de audio""Enseñanza táctil - geometría y color. Juegos didácticos para niños ciegos y videntes""Sistema Constanz"L'ocupació laboral dels cecs a l'Estat espanyol està pràcticament equiparada a la de les persones amb visió, entrevista amb Pedro ZuritaONCE (Organización Nacional de Cegos de España)Prevención da cegueiraDescrición de deficiencias visuais (Disc@pnet)Braillín, un boneco atractivo para calquera neno, con ou sen discapacidade, que permite familiarizarse co sistema de escritura e lectura brailleAxudas Técnicas36838ID00897494007150-90057129528256DOID:1432HP:0000618D001766C10.597.751.941.162C97109C0155020