Skip to content

A cool python function decorator to print comments

License

Notifications You must be signed in to change notification settings

rhuille/verbosify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Verbosify

A cool function decorator to print selected comments 🎤

Installation

Install using pip install -U verbosify or conda install verbosify -c conda-forge.

A Simple Example

from verbosify import verbosify, verbosify_with

@verbosify
def hello_word(uppercase=False):
    # This is the hello_word function
    if uppercase:
        # verbose: return hello word in uppercase
        return 'HELLO WORD'
    else:
        # verbose: return hello word in lowercase
        return 'hello word'

a = hello_word(verbose=True)
#> 'return hello word in lowercase'
print(a)
#> 'hello word'

a = hello_word(uppercase=True, verbose=True)
#> 'return hello word in uppercase'
print(a)
#> 'HELLO WORD'

a = hello_word()
print(a)
#> 'hello word'

a = hello_word(uppercase=True)
print(a)
#> 'HELLO WORD'

You can also choose which comments to print:

@verbosify_with(' ')
def hello_word(uppercase=False):
    # This is the hello_word function
    if uppercase:
        # verbose: return hello word in uppercase
        return 'HELLO WORD'
    else:
        # verbose: return hello word in lowercase
        return 'hello word'

a = hello_word(verbose=True)
#> 'This is the hello_word function'
#> 'return hello word in lowercase'
print(a)
#> 'hello word'

About

A cool python function decorator to print comments

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published