GitHub - davidmckayv/maybe: Python decorator that executes the function, maybe

2 min read Original article ↗

Skip to content

Navigation Menu

Sign in

Appearance settings

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

Python decorator that executes the function, maybe

License

BSD-3-Clause license

3 stars 0 forks Branches Tags Activity

Notifications You must be signed in to change notification settings

Folders and files

NameName

Last commit message

Last commit date

Latest commit

History

3 Commits

Repository files navigation

maybe

Python decorator that executes the function, maybe.

The idea is that some functions should randomly execute. This is implemented as a standard python decorator but using random.randint as a coin flip to decide whether or not the decorated function executes.

Example

@maybe
def say_hello():
    print("Hello!")


say_hello()

About

Python decorator that executes the function, maybe

Resources

Readme

License

BSD-3-Clause license

Activity

Stars

3 stars

Watchers

1 watching

Forks

0 forks

Releases

No releases published

Packages

No packages published

Languages