Skip to content
tell you what functions/methods return a desired result
Python
Find file
Latest commit 2b28531 @kubo39 refactoring
Failed to load latest commit information.
demos few what_func demonstration
whatfunc refactoring
.gitignore ignore *~
README.md change README

README.md


whatfunc

See if this suits your console cravings:

- whatfunc

    from whatfunc import what_func
  • what_func(3, 3)

    complex(3) == 3
    float(3) == 3
    hash(3) == 3
    int(3) == 3
    long(3) == 3
    round(3) == 3
    => ['complex', 'float', 'hash', 'int', 'long', 'round']
    
  • what_func(3.45, 3)

    int(3.45) == 3
    long(3.45) == 3
    round(3.45) == 3
    => ['int', 'long', 'round']
    
  • what_func([1, 2, 3], 3)

    len([1, 2, 3]) == 3
    max([1, 2, 3]) == 3
    => ['len', 'max']
    
  • what_func([1, 2, 3], 6, 'lambda x, y: x+y')

    reduce(lambda x, y: x+y, [1, 2, 3]) == 6
    => ['reduce']
    
  • what_func([1,2,3], [2, 4, 6], 'lambda x: x*2')

    map(lambda x: x*2, [1, 2, 3]) == [2, 4, 6]
    => ['map']
    

whatmethods

    from whatmethods import what_methods
  • what_methods(3, 3)

    3.__abs__() == 3
    3.__hash__() == 3
    3.__index__() == 3
    3.__int__() == 3
    3.__pos__() == 3
    3.__trunc__() == 3
    3.conjugate() == 3
    => ['__abs__', '__float__', '__hash__', '__index__', '__int__', '__long__', '__pos__', '__trunc__', 'conjugate']
    
  • what_methods(2, 2, 2)

    2.__and__(2) == 2
    2.__class__(2) == 2
    2.__or__(2) == 2
    2.__rand__(2) == 2
    2.__ror__(2) == 2
    => ['__and__', '__class__', '__or__', '__rand__', '__ror__']
    
  • what_methods('aaa', 'AAA')

    'aaa'.swapcase() == 'AAA'
    'aaa'.upper() == 'AAA'
    => ['swapcase', 'upper']
    
Something went wrong with that request. Please try again.