Small Python optimizations.