I am trying to make a priority queue without using the Queue module. I have made a class PriorityQueue() and I am trying to create a mk function that takes no arguments and returns an empty queue but can't seem to figure out how. my task function is here:
class Task():
__slots__ = ('name', priority)
def mkTask(myName, myPriority):
t = Task()
t.name = myName
t.priority = myPriority
return t
What I have so far for my PriorityQueue class and a function to check if the queue is empty is this:
class PriorityQueue():
def __init__(queue):
queue.length = 0
queue.first = None
queue.last = None
def is_empty(queue):
return(queue.length == 0)
I can't seem to figure out how to create an instance of the Queue and insert elements of a specific Task into the Queue.