from Hacker News

Show HN: Methodfinder for Python

by billsix on 9/4/19, 1:58 AM with 1 comments

  • by billsix on 9/4/19, 2:18 AM

    Many times, you know the input and output of a procedure that you know must exist, but can't remember the name.

    Methodfinder finds the name. Let me know if you find it useful!

       >>> import methodfinder
       >>> methodfinder.find([]) == 0
       len([])
       sum([])
       >>> methodfinder.find([]) == False
       any([])
       bool([])
       callable([])
       >>> methodfinder.find(3) == "3"
       ascii(3)
       format(3)
       repr(3)
       str(3)
       >>> methodfinder.find([1,2,6,7], 6) == True
       6 in [1, 2, 6, 7]
       [1, 2, 6, 7].__contains__(6)