You are viewing an older version (9.11.0). Go to latest (9.13.0)
{ } Raw JSON

bundles / IPython 9.11.0 / IPython / utils / tokenutil / token_at_cursor

function

IPython.utils.tokenutil:token_at_cursor

source: /IPython/utils/tokenutil.py :98

Signature

def   token_at_cursor ( cell : str cursor_pos : int = 0 )  →  str

Summary

Get the token at a given cursor

Extended Summary

Used for introspection.

Function calls are prioritized, so the token for the callable will be returned if the cursor is anywhere inside the call.

Parameters

cell : str

A block of Python code

cursor_pos : int

The location of the cursor in the block where the token should be found

Aliases

  • IPython.utils.tokenutil.token_at_cursor