Pyhon 自定义数据结构栈

>>> class Stack:
	def __init__(self, size=10):
		self.__size = size
		self.__content = list()
		self.__current = 0
	def isempty(self):
		return self.__current == 0
	def empty(self):
		self.__content.clear()
		self.__current = 0
	def setSize(self, size):
		if size < self.__cuttent:
			self.__content = self.__content[:size]
			self.__current = size
		self.__size = size
	def get(self):
		if self.__current > 0:
			self.__current -= 1
			return self.__content.pop()
		else:
			raise RuntimeError('stack empty')
	def push(self, data):
		if self.__current < self.__size:
			self.__content.append(data)
			self.__current += 1
		else:
			raise RuntimeError('stack full')

		
>>> s = Stack()
>>> s.isempty()
True
>>> s.push(3)
>>> s.push('x')
>>> s.isempty()
False
>>> s.get()
'x'
>>> s.get()
3
>>> s.get()
Traceback (most recent call last):
  File "<pyshell#47>", line 1, in <module>
    s.get()
  File "<pyshell#39>", line 21, in get
    raise RuntimeError('stack empty')
RuntimeError: stack empty