RSS Feed

Peter Goodman's blog about PHP, Parsing Theory, C++, Functional Programming, Applications,

I've Dived Into Python

I recently downloaded the book Dive Into Python and am making my way through the chapters. It's a book on Python for programmers who are curious about the language.

So far I really like the language an what it has to offer. Two things I especially like are the lambdas and list processing functions. In fact I am even thinking of going head on into python and giving PHP a break for a while. This change of heart was sparked by three factors. First, I feel like I write more than I need to with PHP. Languages such as ECMAscript allow you to do things so succinctly that it makes PHP feel brutish. Second, I love functional programming (I also love object-oriented programming) and unfortunately, PHP5 is lacking in that respect. The closest it can come to closures is its create_function() function. create_function is tantamount to using eval() to make a function on the fly. I also find that it doesn't work as I expect it to do so, for example: because create_function just creates a function in the global namespace and returns it is a string. That means that the following will fail: $obj->test = create_function(...); $obj->test();. That was one thing that really disappointed me. Finally, Pihipi made me realize many oh PHP's flaws. This is a funny thought because Pihipi adds almost every feature I've ever wanted to PHP. It also serves as a reminder of many important features that other languages have to offer that PHP doesn't.

To sum up, I haven't had as much coding motivation recently and I think learning Python will change that. I'm excited about using the language, and I'm also curious about the Django framework.

Curiosity is healthy and I think this move will ultimately make me a better programmer.


Comments


Comment