Conversation
There was a problem hiding this comment.
We might want to consider a different method other then len(item) == 2 to determine if this is a (val, priority) tuple here. As is, it will catch cases that we don't want.
For example, if a string of length 2 comes in as an item like PriorityQueue(['hi', (10, 0), ('something else', 1)]), it will potentially examine 'hi', find it has length 2 and then:
self.insert('h', 'i')
Which isn't what we want.
There was a problem hiding this comment.
Ok, look at the doc string. Iterables have to be packaged using the (val, priority) notation. I think it's reasonable. Let me know what you think.
There was a problem hiding this comment.
Understood. Then why don't we just eliminate "A non-iterable value" and require all non-QNode objects to be passed in as a container? It will simplify and eliminate unintended effects like described above.
So, each item inside iterable can be either:
- a QNode object
- a tuple with value, priority (if priority not given, assume priority None)
I think we can be explicit here.
There was a problem hiding this comment.
We'll open this as a separate issue if we want to address it.
All milestone issues complete.