Skip to main content

Stack module

An example of a stack in Python 3

Example usage

import stackModule
from stackModule import stackTools
from random import randint as rand

stackOptions = {
    'pointer': -1,
    'size': 5,
    'type': int
}

stackHandler = stackTools()


stackHandler.stackOptions = stackOptions
stackHandler.stack = stackHandler.initStack(stackOptions['size'],stackOptions['type'])

print(stackHandler.dump())

stackHandler.push(3)
print(stackHandler.dump())
for i in range (0,rand(0,30)):
    try:
        n=rand(0,651)
        stackHandler.push(n)
        print(f'Added {n}')
    except stackmodule.StackFull: print("Stack got full")

print(stackHandler.dump())
print(stackHandler.pop())
print(stackHandler.dump())
stackHandler.push(5)
print(stackHandler.dump())


stack = stackHandler.dump()

print("The script exported the stack: "+str(stack))

Module features

Making a stack handler

stackHandler=stackTools(myStack,stackOptions)#Define our stack handler

A stack handler will simply hold the stackTools class with your stack and it's options

Initialise stack (initStack)

stack=stackHandler.initStack(5,int) # Initialise a new stack which can contain 5 integer values

Initialise stack will update the list that is acting as a stack to the correct size with the expected data format

This will most likely never be updated

Metadata

Release files for stack-module 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stack-module 0.1.4
File Size Uploaded
stack-module-0.1.4.tar.gz 2.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for stack-module 0.1.4
File Interpreter ABI Platform
stack_module-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 6.5 kB

Release files / stack-module-0.1.4.tar.gz

Download URL stack-module-0.1.4.tar.gz
Size 2.8 kB
Tags Source
SHA-256 checksum
How to use checksums
15149528fcade882eb96e3ad2f33fc3c68e123e00d4af16eb9c2dddbb66a6096
BLAKE2b-256 checksum
How to use checksums
bd6165289cc684dad039d0917580f48958214b730b28de430a90940e6c6c4337
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.0.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.2

Release files / stack_module-0.1.4-py3-none-any.whl

Download URL stack_module-0.1.4-py3-none-any.whl
Size 3.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d3d6c702f1ce83c904a3b8151013422aa71566f53ed88aadeff120a292114350
BLAKE2b-256 checksum
How to use checksums
8468299340443015a21f22ce8f63675f1572019ec2d599a4039a1e613f9477b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.0.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.2

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page