Simplify py/scala chapter six examples