Search notes:

Python standard library: inspect

import inspect

def xyz(ab, cd = 'foo bar', ef = 42):
    pass


a  = inspect.getargspec(xyz)

print "Arguments:"
for arg in a.args:
    print "  " + arg


print "\nDefaults:"
for def_ in a.defaults:
    print "  " + str(def_)


# Arguments:
#   ab
#   cd
#   ef
# 
# Defaults:
#   foo bar
#   42
Github repository about-python, path: /standard-library/inspect/script.py

getsource

import inspect

def F(a):
    print(f'F says {a}')

print(inspect.getsource(F))
Github repository about-Python, path: /standard-library/inspect/getsource.py

See also

standard library

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1745043127, '3.147.63.58', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/Python/standard-library/inspect/index(75): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78