Book Image

Python for Finance

By : Yuxing Yan
Book Image

Python for Finance

By: Yuxing Yan

Overview of this book

Table of Contents (20 chapters)
Python for Finance
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Finding out more information about a specific built-in function


To understand each math function, we apply the help() function, such as help(round), as shown in the following example:

>>>help(round)
Help on built-in function round in module builtins:
round(...)
    round(number[, ndigits]) -> number
Round a number to a given precision in decimal  
digits (default 0 digits).This returns an int when 
called with one argument, otherwise the same type as 
the number. ndigits may be negative.

Listing all built-in functions

To find out all built-in functions, we perform the following two-step approach. First, we issue dir() to find the default name that contains all default functions. When typing its name, be aware that there are two underscores before and another two underscores after the letters of builtins, that is, __builtins__:

>>>dir()
['__builtins__', '__doc__', '__loader__', '__name__', '__package__', 'x']

Then, we type dir(__builtins__). The first and last couple...