cleaner way to write this?

Neil Cerutti horpner at yahoo.com
Wed Oct 25 15:48:36 EDT 2006


On 2006-10-25, John Salerno <johnjsal at NOSPAMgmail.com> wrote:
> Paul Rubin wrote:
>
>> Right.  The above handles that case, I believe. 
>
> Oh, you're right! It's amazing how this went from a simple,
> two-line method to a big mess of error-checking. :)

>From Kernighan & Pike, _The Practice of Programming_ (ISBN
0-201-61586-X):

  This completes our C version [of a csv reading library]. It
  handles arbitrarily large inputs and does something sensible
  even with perverse data. The price is that it is more than four
  times as long as the first prototype and some of the code is
  intricate. Such expansion of size and complexity is a typical
  result of moving from prototype to production.

(It's a useful book, especially for a hobbyist programmer. Though
there's not much Python code in it, pretty much all the advice
inside is applicable to writing Python code.)

-- 
Neil Cerutti



More information about the Python-list mailing list