When programming in Python using Geany, I get a helpful prompt for the **print** function:

But none for the equally important **range** function:

Please could Geany provide helpful prompts for **all** of the Python **builtin** functions?
https://docs.python.org/3/library/functions.html

In Python `range()` is __not a function__, it is a class, see [here](https://docs.python.org/3/library/stdtypes.html#ranges), and the function looking like `range()` is actually a constructor for the `range` class objects, not a function.
In the `std.py.tags` tags file, some of the class constructors have signatures, and some do not. Classes with signature can show calltips, but classes without signatures have nothing to provide a calltip. One of the classes that have no signature is `range` so it has no calltip.
Without spending detailed analysis it appears to me that classes that are implemented by Python have a signature and those which are implemented by C code do not have a signature since the parameters for the class constructor are analysed by C code and there is no Python definition.
In particular [`rangeobject.c`](https://github.com/python/cpython/blob/main/Objects/rangeobject.c) in Python source is the source of the definition for the `class range` and so no constructor signature exists in Python.
The `std.py.tags` is automatically generated from Python, so there are no calltips for any classes that have no signature and they will have no calltip.
If a user really wants some or __all__ class constructors they may be able to hand craft a tags file for those they want by reading the C code of python and/or the details in the Python documentation. But theer is not automatic means of creating such a tags file.
(On my mission to shamelessly cross-promote my LSP plugin wherever I can.)
This is possible with the LSP plugin (https://github.com/techee/geany-lsp). I've just tried and it works with jedi-language-server, pyright and pylsp servers. I recommend to try `jedi-language-server` first as it offers the most hassle-free experience out of the box.
Closed #4011 as completed.
@elextr's analysis is correct, thanks.
I think adding signature support for such builtins can get quite hard. Currently, we use Python's `inspect` to retrieve the signatures and it cannot get the signature for `range`:
```pycon >>> import inspect >>> inspect.signature(print) <Signature (*args, sep=' ', end='\n', file=None, flush=False)> >>> inspect.signature(range) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python3.12/inspect.py", line 3341, in signature return Signature.from_callable(obj, follow_wrapped=follow_wrapped, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/inspect.py", line 3081, in from_callable return _signature_from_callable(obj, sigcls=cls, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/inspect.py", line 2662, in _signature_from_callable raise ValueError( ValueError: no signature found for builtin type <class 'range'> ```
github-comments@lists.geany.org