25-02-2022

148 words 1 minute

Topic

Learning with others this morning - looking through Python testing using unittest once again. One amongst my peer group has a fantastic way of explaining things, and produces clear, logical code!

It is a pleasure to work with them, and together real progress was made. I hope I get to work with them in the future - in fact I hope I get to work with my peer group, as a team, in the future.

PragProg - Intuitive Python

use docstrings on classes and methods

by using python docstrings

to describe the behaviour of a class or method

def some_function():
	# doc string below
	"""This function returns 42"""
	return 42

print(some_function.__doc__)
# OUTPUT:This function returns 42

dir(object)

It's possible to use the dir(some_object) to define all the methods and attributes attached to it

some_list = []

dir(some_list)

object.mro

Method Resolution Order

using object.mro will access the class hierarchy of the list

pdb

Python 3.7 contains a built in debugger to halt a programme at any line during execution