Skip to content

Various utilities for handling loops, recursions, etc.

License

Notifications You must be signed in to change notification settings

arrrlo/enveloop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

enveloop

PyPI version Build Status GitHub GitHub last commit

Various utilities for handling loops, recursions, etc.

Limit number of recursions

Let's say you wrote a recursive function and you want to limit number of recursions, just to be infinite loop free, or for any other reason.

from enveloop import limit_recursion_to


# let's limit the number of recursion to 100

@limit_recursion_to(100)
def my_func(arg):
    ...
    my_func(arg)
    ...


# let's limit the number of recursion and after 
# the 10th recursion run a callback function.
# callback function takes exactly the same arguments
# as the recursion function.

@limit_recursion_to(10, lambda arg: ...)
def my_func(arg):
    ...
    my_func(arg)
    ...

Changelog

0.1.0

Added:

  • limit_recursion_to()

About

Various utilities for handling loops, recursions, etc.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages