python: add option to skip leading spaces
go: tidy up implementation