【发布时间】:2014-04-21 02:33:36
【问题描述】:
“您将编写 Python 类 Queue。它将有两个插槽:stack1 和 stack2。您还将编写不带参数并将两个插槽初始化为空堆栈的 maker 函数 mkQueue。”所以,我有这个:,但我不确定它是要求我将参数留空还是将堆栈放入其中?
class Queue():
__slots__ = ('stack1', 'stack2')
def mkQueue(stack1, stack2):
Queue.stack1 = stack1
Queue.stack2 = stack2
return Queue
【问题讨论】:
-
忽略 mkQueue() 函数中的单引号
-
我不知道我是否回答了你的问题,但想想还是很有趣的。