import syntax

Neil Cerutti neilc at norwich.edu
Tue Jul 30 09:03:32 EDT 2013


On 2013-07-29, Joshua Landau <joshua at landau.ws> wrote:
> Sure, just as one light is no brighter or dimmer than another
> when disregarding luminosity.
>
> As people have said, it improves diffs as well. It flows
> quicker into the "from module import things" form (which I oft
> prefer), too.
>
> When asking these questions, ask yourself "why would it
> *compile* differently? It wouldn't. Plus, premature
> optimisation is the root of all evil.
>
> 1) Write your code
> 2) If it's slow:
> 2a) Do you have time? If so:
> 2b) Is it important to speed up, or is the slowness not worth spending the
> hours fixing?
> 2c) Profile it to see what's actually slow
> 2d) Realise that the slow part is not what you thought it was
> 2e) Fix the bit that's slow (and nothing else)
> 2f) Repeat from 2
> 3) Write some more code

1a) Does it work?
1b) Can you prove it?

It's best to at least have some regression tests before you start
refactoring and optimizing.

-- 
Neil Cerutti



More information about the Python-list mailing list