approach to writing functions

Bart Nessux bart_nessux at hotmail.com
Mon Feb 9 21:54:22 EST 2004


Ben Finney wrote:

> I've no idea how "re-use the code" leads you to think of more specific
> functions -- surely the trend would be to more *generic* functions, that
> can thus be re-used in more places?

Yes, I got that part backwards. I meant generic. Thank you for pointing it
out. I'm dyslexic. To me, left is right and right is left. I work a lot
with files and file systems in general. I have a function that counts the
number of objects in a FS and returns that. It's very generic and can be
used with most any py script that needs to know how many FS objects are in
a certain path before doing something else.

> I recommend you get a copy of Code Complete (Steve McConnell, published
> by Microsoft Press).  It is an extremely comprehensive and approachable
> tome on the actual practice of writing code.
> 
> In particular, it explains just about every reason to use abstraction in
> data, code and algorithms.  Some you may have heard before, but my
> feeling from your message is that a lot of it will be new -- and all of
> it is valuable.

Thank you, I'll look into this 



More information about the Python-list mailing list