Package pyarabic ::
Module stack
|
|
1
2
3 """
4 Stack module
5 @author: Taha Zerrouki
6 @contact: taha dot zerrouki at gmail dot com
7 @copyright: Arabtechies, Arabeyes, Taha Zerrouki
8 @license: GPL
9 @date:2010/03/01
10 @version: 0.1
11 """
13 """
14 Stack class
15 """
17 """
18 create a stack
19 """
20 self.items = list(text)
21
22 - def push(self, item) :
23 """
24 puch an item into the stack
25 @param item: pushed item
26 @type item : mixed
27 @return : None
28 @rtype: None
29 """
30 self.items.append(item)
31
33 """
34 pop an item from the stack
35 @return: poped item
36 @rtype: mixed
37 """
38 if not self.is_empty():
39 return self.items.pop()
40 else:
41 return None
42
44 """
45 test if the stack is empty
46 @return: True or False
47 @rtype: boolean
48 """
49 return (self.items == [])
50