Skip to content

krakotay/function-switcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Function Switcher

A Python decorator that allows switching function calls behavior. When you pass a string argument to a function, it's interpreted as the target function name, while the original function name becomes the argument.

Installation

pip install git+https://github.com/krakotay/function-switcher.git

Usage

from function_switcher import switch_call
@switch_call
def main():
    helloworld('print')  # helloworld
    (hello + world)('print')  # helloworld
    
    leng = 10
    (engt)('print')  # engt
    (l + f'{leng}' + th)('print') # l10th 
    
    a = " 10 "
    num = 42
    (hello + a + world)('print') # hello 10 world
    (hello + f'{num}' + world)('print') # hello42world
    
    length = mystring('len')  
    (mystring + ' length == ' + f'{length}')('print') #mystring length == 8

main()

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages