how to avoid checking the same condition repeatedly ?

Chris Angelico rosuav at gmail.com
Tue Oct 29 03:09:41 EDT 2013


On Tue, Oct 29, 2013 at 5:53 PM, Peter Cacioppi
<peter.cacioppi at gmail.com> wrote:
> But this sort of bottleneck refactoring can be done in a careful way that minimizes the damage to readability. And a strength of py is it tends to encourage this "as pretty as possible" approach to bottleneck refactoring.
>
> This is what you're saying, right?

Yep, that's about the size of it. Want some examples of what costs no
clarity to reimplement in another language? Check out the Python
standard library. Some of that is implemented in C (in CPython) and
some in Python, and you can't tell and needn't care which. Code
clarity isn't hurt, because those functions would be named functions
even without.

ChrisA



More information about the Python-list mailing list