python improvement