# 4.8 Using IPython Tab Completion for Discovery¶

- View a module’s documentation in IPython interactive mode via tab completion.
- After you type a portion of an identifier and press Tab, IPython completes the identifier for you or provides a list of identifiers that begin with what you’ve typed so far.

In [1]:

    import math

In [ ]:

    # press <Tab> after ma
    ma

### Viewing Identifiers in a Module¶

- To view a list of identifiers defined in a module, type the module’s name and a dot (`.`), then press Tab:

In [ ]:

    # press <Tab> after the dot
    math.

- Python does not have constants, although many objects in Python are immutable (nonmodifiable).
- Even though `pi` and `e` are real-world constants, you must not assign new values to them, because that would change their values.
- To help distinguish constants from other variables, the style guide recommends naming your custom constants with all capital letters.

### Using the Currently Highlighted Function¶

- As you navigate through the identifiers, if you wish to use a currently highlighted function, simply start typing its arguments in parentheses.
- If you need more information about the currently highlighted item, you can view its docstring by typing a question mark (`?`) following the name and pressing Enter to view the help documentation.

In [2]:

    math.fabs?

    Signature: math.fabs(x, /)
    Docstring: Return the absolute value of the float x.
    Type:      builtin_function_or_method

- The `builtin_function_or_method` shown above indicates that `fabs` is part of a Python Standard Library module.
- Such modules are considered to be built into Python.
- In this case, `fabs` is a built-in function from the `math` module.

©1992–2020 by Pearson Education, Inc. All Rights Reserved. This content is based on Chapter 4 of the book Intro to Python for Computer Science and Data Science: Learning to Program with AI, Big Data and the Cloud.

DISCLAIMER: The authors and publisher of this book have used their best efforts in preparing the book. These efforts include the development, research, and testing of the theories and programs to determine their effectiveness. The authors and publisher make no warranty of any kind, expressed or implied, with regard to these programs or to the documentation contained in these books. The authors and publisher shall not be liable in any event for incidental or consequential damages in connection with, or arising out of, the furnishing, performance, or use of these programs.