ipython help functions(?)(??) dosen't describe info properly

Question:

installed IPython version 8.5.0 via conda.

after running ‘?’ in shell this is part of output:

  object?   -> Details about 'object'.
  object??  -> More detailed, verbose information about 'object'.

so for trying this i also executed:

In [5]: len?
Signature: len(obj, /)
Docstring: Return the number of items in a container.
Type:      builtin_function_or_method

In [6]: len??
Signature: len(obj, /)
Docstring: Return the number of items in a container.
Type:      builtin_function_or_method

as you see there’s no different between two functions result, while ‘??’ should reference to source code (based on a book I’m reading) and show more information about object, but it’s not happening.

so i think this function isn’t working properly, what can i do about it?

link to book im reading

Asked By: Naadiyaar

||

Answers:

In this case, len?? doesn’t give the source code because the source code is not in Python. It’s in C. However, for other functions it will work:

In [1]: import antigravity

In [2]: antigravity.geohash?
Signature: antigravity.geohash(latitude, longitude, datedow)
Docstring:
Compute geohash() using the Munroe algorithm.

>>> geohash(37.421542, -122.085589, b'2005-05-26-10458.68')
37.857713 -122.544543
File:      c:usersdanieappdatalocalprogramspythonpython310libantigravity.py
Type:      function

In [3]: antigravity.geohash??
Signature: antigravity.geohash(latitude, longitude, datedow)
Source:
def geohash(latitude, longitude, datedow):
    '''Compute geohash() using the Munroe algorithm.

    >>> geohash(37.421542, -122.085589, b'2005-05-26-10458.68')
    37.857713 -122.544543

    '''
    # https://xkcd.com/426/
    h = hashlib.md5(datedow, usedforsecurity=False).hexdigest()
    p, q = [('%f' % float.fromhex('0.' + x)) for x in (h[:16], h[16:32])]
    print('%d%s %d%s' % (latitude, p[1:], longitude, q[1:]))
File:      c:usersdanieappdatalocalprogramspythonpython310libantigravity.py
Type:      function
Answered By: pigrammer
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.