Skip to main content

An example of a stack in Python 3

Project description

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'])


for i in range (0,rand(0,30)):
        print(f'Added {n}')
    except stackmodule.StackFull: print("Stack got full")


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

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for stack-module, version 0.1.4
Filename, size File type Python version Upload date Hashes
Filename, size stack_module-0.1.4-py3-none-any.whl (3.7 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size stack-module-0.1.4.tar.gz (2.8 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page