MCPcopy Create free account
hub / github.com/ActiveState/code / Stacks

Class Stacks

recipes/Python/361168_Vpython_example/recipe-361168.py:118–133  ·  view source on GitHub ↗

Represents the stacks where all the blocks are

Source from the content-addressed store, hash-verified

116
117
118class Stacks(object):
119 """Represents the stacks where all the blocks are"""
120
121 def __init__(self, num):
122 """Pass the number of stacks"""
123 self.blockCount = num
124 # Create our list of blocks. This will never change
125 self.blocks = [VBlock(self, i) for i in range(num)]
126 # Create a list of stacks. Each stack is represented by a list
127 self._stacks = []
128 for i in range(num):
129 self._stacks.append([self.blocks[i]])
130
131 def __getitem__(self, i):
132 """Just enables people to access our stacks in an easy readonly way"""
133 return self._stacks.__getitem__(i)
134
135
136class Block(object):

Callers 1

parseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected