So I'm getting my mind toyed with right now. I feel like I've found a bug in python, but I'm sure that can't be the case. Can someone point out what I'm missing?
class LinkedList():
def __init__(self):
pass
def SortedLinkedList(LinkedList):
pass
new_list = SortedLinkedList()
gives
TypeError: SortedLinkedList() takes exactly 1 argument (0 given)
while
new_list = SortedLinkedList("wtf")
works fine. What is going on?
def SortedLinkedList(LinkedList):
will create a function, not a class. Perhaps you meant
class SortedLinkedList(LinkedList):
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.