Skip to main content

It is documented package 'pkg_stack' which provides feature 'stack' functionality

Project description

stack_ops package

Author: Suyog K Sethia

I have created documented package 'pkg_stack' which provides feature 'stack' general functionality, with exception handling. I also threw in unittest, which is runnable after installing package, and it checks sanity of package 'pkg_stack'.

Install Package 'pkg_stack' via pip:

pip install pkg-stack-skscodes

To Import Package 'pkg_stack':

import pkg_stack

Find Attributes:

>>>from pkg_stack.mystack import Stack
>>>dir(Stack)
>>>dir(Stack())

Find Help:

>>>help(Stack.from_values)        
Help on method from_values in module pkg_stack.mystack:    

 from_values(*args) method of builtins.type instance    
     Construct a Stack from given values.    

    Params:    
    *args: Integer values to be pushed onto the stack being created.    

    Returns: The newly created Stack object
>>>help(Stack.pop)
Help on function pop in module pkg_stack.mystack:

pop(self)
    Pop a value from the stack.

    Returns: The integer value popped from the stack.

    Raises:
    StackEmptyError: When trying to pop from empty stack.

Example:

>>>from pkg_stack.mystack import Stack                   
>>>s = Stack.from_values(1,2,3,4)           
>>>print(s)     
[1, 2, 3, 4]    

Exception Handling:

sample case-1:

>>>from pkg_stack.mystack import Stack                    
>>>s = Stack()               
>>>s.pop()      
stack is empty.       

sample case-2:

>>>s =Stack.from_values(1,2,3,4,5)            
>>>s.push(5)      
stack is full.     

To see full demo of Package 'pkg_stack' operations in video-like manner:

>>>import pkg_stack.mystack     
>>>pkg_stack.mystack.main()         
demo begins..
..  
.. 

Enjoy!

Project details


Download files

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

Source Distribution

pkg-stack-skscodes-0.0.64.tar.gz (3.9 kB view hashes)

Uploaded Source

Built Distribution

pkg_stack_skscodes-0.0.64-py3-none-any.whl (5.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page