learning python patterns