On Mon, 19 Sep 2005, beza1e1 wrote: > I see myself shifting more and more over to the functional kind of > coding. Could be related to the Haskell, we had to learn in CS. Now i > was wondering, how other people use Python?
I'm a lot like you. I grew up with java, and learned to write classical object-oriented code. When i came over to python, i very quickly found myself writing more procedural, and in fact functional, code. I think this is a result of the kind of programs i'm writing. Objects are good when you have entities that will live a long and unpredictable life - chunks of text in a word processor, for example. If you're writing programs with simpler narratives, though, as i often am ("read in this data, parse it, transform it like so, shuffle it like this, then write it out like this"), a functional approach allows a simpler, cleaner factoring of the code. > With functional i mean my files mostly consist of functions and only > rarely i use "class". The library modules seem to be mostly written the > object-way on the other hand. The thing about OO code is that the pieces are self-contained, which makes this a good way to write library code. That's not a good explanation, but i haven't had any coffee this morning, so that's the best i can do right now. tom -- Science runs with us, making us Gods. -- http://mail.python.org/mailman/listinfo/python-list