<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Python or PHP?</title>
	<atom:link href="http://muffinresearch.co.uk/archives/2007/11/27/python-or-php/feed/" rel="self" type="application/rss+xml" />
	<link>http://muffinresearch.co.uk/archives/2007/11/27/python-or-php/</link>
	<description>the personal blog of Stuart Colville covering modern web development techniques and best practices</description>
	<pubDate>Thu, 16 Oct 2008 03:40:16 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: mozey</title>
		<link>http://muffinresearch.co.uk/archives/2007/11/27/python-or-php/#comment-64600</link>
		<dc:creator>mozey</dc:creator>
		<pubDate>Tue, 07 Oct 2008 03:05:11 +0000</pubDate>
		<guid isPermaLink="false">http://muffinresearch.co.uk/archives/2007/11/27/python-or-php/#comment-64600</guid>
		<description>I have been coding in both languages. Short answer is, PYTHON.</description>
		<content:encoded><![CDATA[<p>I have been coding in both languages. Short answer is, PYTHON.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff</title>
		<link>http://muffinresearch.co.uk/archives/2007/11/27/python-or-php/#comment-63841</link>
		<dc:creator>Jeff</dc:creator>
		<pubDate>Thu, 03 Jan 2008 21:27:44 +0000</pubDate>
		<guid isPermaLink="false">http://muffinresearch.co.uk/archives/2007/11/27/python-or-php/#comment-63841</guid>
		<description>I've just attempted to use a python sample program on 3 of the 5 servers I use for PHP applications.  All I got was a list of the sample text.  I named the program 'sample.py' and on my PC the little green snake appears.

Until the hosting servers I use support Python out of the box, like they do with PHP, there is no question which language I prefer - PHP.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve just attempted to use a python sample program on 3 of the 5 servers I use for PHP applications.  All I got was a list of the sample text.  I named the program &#8217;sample.py&#8217; and on my PC the little green snake appears.</p>
<p>Until the hosting servers I use support Python out of the box, like they do with PHP, there is no question which language I prefer - PHP.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adam</title>
		<link>http://muffinresearch.co.uk/archives/2007/11/27/python-or-php/#comment-63745</link>
		<dc:creator>Adam</dc:creator>
		<pubDate>Tue, 04 Dec 2007 15:00:03 +0000</pubDate>
		<guid isPermaLink="false">http://muffinresearch.co.uk/archives/2007/11/27/python-or-php/#comment-63745</guid>
		<description>Both have their advantages and disadvantages, but I think if PHP included namespaces, cleaned up their function naming conventions - or introduced one, and moved a lot of the default functions off into namespaces, then PHP will become rather untouchable, I feel.</description>
		<content:encoded><![CDATA[<p>Both have their advantages and disadvantages, but I think if PHP included namespaces, cleaned up their function naming conventions - or introduced one, and moved a lot of the default functions off into namespaces, then PHP will become rather untouchable, I feel.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stuart Colville</title>
		<link>http://muffinresearch.co.uk/archives/2007/11/27/python-or-php/#comment-63736</link>
		<dc:creator>Stuart Colville</dc:creator>
		<pubDate>Fri, 30 Nov 2007 15:53:00 +0000</pubDate>
		<guid isPermaLink="false">http://muffinresearch.co.uk/archives/2007/11/27/python-or-php/#comment-63736</guid>
		<description>@Stuart: cheers for the tip I'll take a look at that. Sounds like the best solution for quick experiments.</description>
		<content:encoded><![CDATA[<p>@Stuart: cheers for the tip I&#8217;ll take a look at that. Sounds like the best solution for quick experiments.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stuart Langridge</title>
		<link>http://muffinresearch.co.uk/archives/2007/11/27/python-or-php/#comment-63733</link>
		<dc:creator>Stuart Langridge</dc:creator>
		<pubDate>Fri, 30 Nov 2007 08:34:20 +0000</pubDate>
		<guid isPermaLink="false">http://muffinresearch.co.uk/archives/2007/11/27/python-or-php/#comment-63733</guid>
		<description>It is pretty easy to just chuck up a Python file; just make it a CGI. It's slower, of course, but just name it whatever.cgi, stick AddHandler cgi-script .cgi in your .htaccess, and use Python's cgi modile to get form data. Pow, done. I do this all the time for small stuff.</description>
		<content:encoded><![CDATA[<p>It is pretty easy to just chuck up a Python file; just make it a CGI. It&#8217;s slower, of course, but just name it whatever.cgi, stick AddHandler cgi-script .cgi in your .htaccess, and use Python&#8217;s cgi modile to get form data. Pow, done. I do this all the time for small stuff.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stuart Colville</title>
		<link>http://muffinresearch.co.uk/archives/2007/11/27/python-or-php/#comment-63731</link>
		<dc:creator>Stuart Colville</dc:creator>
		<pubDate>Thu, 29 Nov 2007 15:04:01 +0000</pubDate>
		<guid isPermaLink="false">http://muffinresearch.co.uk/archives/2007/11/27/python-or-php/#comment-63731</guid>
		<description>@everyone: There's been some excellent points made above, thanks for sharing your views.

Up until now I've used PHP much more for web stuff but I am really interested in being able to play with using Python for simple scripts on the web. Normally I tend to resort to using PHP for this as it's just so much quicker. I really wish there was a quick way to be able to bung a .py file up onto a web-server without having to think about it.

Probably what I need to do is look at the Django handler and then write something generic suited for this task; if anyone has any good pointers in this area then please let me know, I've no doubt someon has already done this.

For bigger web-apps I've been using Django. The more that I use it the more I love it, it's simple extensible and well thought out. It's great to use something that allows you to get on with building the interesting parts of your application. In addition I'm impressed with how easy it is to add to the generic stuff that's built-in. Part of this is purely down to Python's flexibility.

I like the feel of coding in Python much more than PHP; partly this is down to syntax, but also idiom.
	Although some idioms seem a little daunting at first I've grown to really appreciate them. I now find myself spending a little longer until I find a more 'Python' way of expressing something. I think all of this adds up to making Python code much more consistent overall and less mutated by people's own coding preferences. Naturally the enforced indentation seems strange at first I've come to love it as it makes code so much more readable.

On the whole for me the Python bug has really bitten. Since creating TweetyPy as a fun project for learning the language (I'm currently working on a complete re-write) I'm really sold on using it for everything I can. I've still got time for PHP and naturally being the chosen server-side scripting language at YAHOO I'll be continuing to use it for the foreseeable, however, at every opportunity where Python can be used and it makes sense to do so, Python is my preference.</description>
		<content:encoded><![CDATA[<p>@everyone: There&#8217;s been some excellent points made above, thanks for sharing your views.</p>
<p>Up until now I&#8217;ve used PHP much more for web stuff but I am really interested in being able to play with using Python for simple scripts on the web. Normally I tend to resort to using PHP for this as it&#8217;s just so much quicker. I really wish there was a quick way to be able to bung a .py file up onto a web-server without having to think about it.</p>
<p>Probably what I need to do is look at the Django handler and then write something generic suited for this task; if anyone has any good pointers in this area then please let me know, I&#8217;ve no doubt someon has already done this.</p>
<p>For bigger web-apps I&#8217;ve been using Django. The more that I use it the more I love it, it&#8217;s simple extensible and well thought out. It&#8217;s great to use something that allows you to get on with building the interesting parts of your application. In addition I&#8217;m impressed with how easy it is to add to the generic stuff that&#8217;s built-in. Part of this is purely down to Python&#8217;s flexibility.</p>
<p>I like the feel of coding in Python much more than PHP; partly this is down to syntax, but also idiom.<br />
	Although some idioms seem a little daunting at first I&#8217;ve grown to really appreciate them. I now find myself spending a little longer until I find a more &#8216;Python&#8217; way of expressing something. I think all of this adds up to making Python code much more consistent overall and less mutated by people&#8217;s own coding preferences. Naturally the enforced indentation seems strange at first I&#8217;ve come to love it as it makes code so much more readable.</p>
<p>On the whole for me the Python bug has really bitten. Since creating TweetyPy as a fun project for learning the language (I&#8217;m currently working on a complete re-write) I&#8217;m really sold on using it for everything I can. I&#8217;ve still got time for PHP and naturally being the chosen server-side scripting language at YAHOO I&#8217;ll be continuing to use it for the foreseeable, however, at every opportunity where Python can be used and it makes sense to do so, Python is my preference.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gareth</title>
		<link>http://muffinresearch.co.uk/archives/2007/11/27/python-or-php/#comment-63730</link>
		<dc:creator>Gareth</dc:creator>
		<pubDate>Thu, 29 Nov 2007 12:27:41 +0000</pubDate>
		<guid isPermaLink="false">http://muffinresearch.co.uk/archives/2007/11/27/python-or-php/#comment-63730</guid>
		<description>Interesting that, increasingly, good PHP people have been playing with other languages - in particular it seems - Python. 

I like using both for different things. Python for throwing things around on the command line, general purpose scripting and the like. I'm pretty happy with PHP for either small web stuff (it's fast) and for bigger bits and pieces (now using symfony).

Agree that PHP frameworks don't make life easier, but they do make your code better (as you say - security, internationalisation, encourage good practice, etc.</description>
		<content:encoded><![CDATA[<p>Interesting that, increasingly, good PHP people have been playing with other languages - in particular it seems - Python. </p>
<p>I like using both for different things. Python for throwing things around on the command line, general purpose scripting and the like. I&#8217;m pretty happy with PHP for either small web stuff (it&#8217;s fast) and for bigger bits and pieces (now using symfony).</p>
<p>Agree that PHP frameworks don&#8217;t make life easier, but they do make your code better (as you say - security, internationalisation, encourage good practice, etc.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brad Wright</title>
		<link>http://muffinresearch.co.uk/archives/2007/11/27/python-or-php/#comment-63727</link>
		<dc:creator>Brad Wright</dc:creator>
		<pubDate>Wed, 28 Nov 2007 16:59:26 +0000</pubDate>
		<guid isPermaLink="false">http://muffinresearch.co.uk/archives/2007/11/27/python-or-php/#comment-63727</guid>
		<description>Well there's not much one could reasonably add after Cyril's well-reasoned argument, but just to re-enforce:

I've not really used Python much, but I've been writing PHP for a while (5+ years). I don't necessarily think it's fair to say that bad libraries are PHP's fault, as that's a necessary evil of a language being the de-facto standard and being so easy to adopt--bad coders will come and write bad code in it. Look at Javascript if you don't believe me.

Regardless, PHP can be used elegantly and in a web-friendly way if used correctly and with an eye towards maintainability. Ridiculous OO syntax and features don't necessarily lend themselves towards your average website anyway, so I'd argue this isn't always necessary for a normal site.

Also, the widespread adoption of PHP (and its partner in dev MySQL) make the "write once run anywhere" maxim almost true for that duo. This goes a long way towards affecting your choice of language for a project.

As far as syntax goes, Python certainly looks more elegant--I just need to find some time to have a proper look. ;)</description>
		<content:encoded><![CDATA[<p>Well there&#8217;s not much one could reasonably add after Cyril&#8217;s well-reasoned argument, but just to re-enforce:</p>
<p>I&#8217;ve not really used Python much, but I&#8217;ve been writing PHP for a while (5+ years). I don&#8217;t necessarily think it&#8217;s fair to say that bad libraries are PHP&#8217;s fault, as that&#8217;s a necessary evil of a language being the de-facto standard and being so easy to adopt&#8211;bad coders will come and write bad code in it. Look at Javascript if you don&#8217;t believe me.</p>
<p>Regardless, PHP can be used elegantly and in a web-friendly way if used correctly and with an eye towards maintainability. Ridiculous OO syntax and features don&#8217;t necessarily lend themselves towards your average website anyway, so I&#8217;d argue this isn&#8217;t always necessary for a normal site.</p>
<p>Also, the widespread adoption of PHP (and its partner in dev MySQL) make the &#8220;write once run anywhere&#8221; maxim almost true for that duo. This goes a long way towards affecting your choice of language for a project.</p>
<p>As far as syntax goes, Python certainly looks more elegant&#8211;I just need to find some time to have a proper look. <img src='http://muffinresearch.co.uk/wordpress/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cyril Doussin</title>
		<link>http://muffinresearch.co.uk/archives/2007/11/27/python-or-php/#comment-63726</link>
		<dc:creator>Cyril Doussin</dc:creator>
		<pubDate>Wed, 28 Nov 2007 15:42:33 +0000</pubDate>
		<guid isPermaLink="false">http://muffinresearch.co.uk/archives/2007/11/27/python-or-php/#comment-63726</guid>
		<description>What I have done so far in Python boils down to Django sites essentially.
It goes without saying that Django is an absolute pleasure to use and using a framework like this almost makes you forget which language you are using sometimes.
But anyway, with my (unfortunately) limited experience, here is my take on the PHP vs Python issue (in random order):

* PHP is dead simple, Python has a slight more complex learning curve.
This is essentially because PHP is at heart a templating language, with other features such as the object model built on top of it, whereas Python is a general purpose language, architecture from the ground up to support.

* Introspection in PHP is still too limited, or at least doesn't feel right to me, yet. I'm sure this will get improved version after version. Once again this is mainly a concern for  object-oriented codebases, and once again this comes down to the actual nature of the languages at stake: PHP is originally a template language, when 99% of Python is built on object-oriented concepts.

* PHP is almost entirely used for web development and is readily available in every web hosting environment. Python is also present in most web development environments, but as a normal interpreter, it is much more rare to find mod_python ready for use. It is even more rare to find web hosting environments ready for use with Django, Turbo Gears or any other popular Python webdev framework. Quite a few newish web hosting companies have setup solutions for this now though (Textdrive, Webfaction, Media Temple, Dreamhost etc can all run at least Django without a problem I believe).

* Python's enforced code indentation is brilliant. It has never gotten in the way for me but it has for direct result to make any Python code readable. Many times, even in professional environments have I seen messy unreadable PHP code. I have never been able to not read easily Python code developed by third parties.

* PHP is still missing or mis-implementing important features which any serious development project requires. In my mind the object model still mostly sucks. Unicode support is still not there. Namespacing was dropped from PHP5 as it was considered "syntactic sugar" (I call BS). On the other hands when I started using Python I discovered all these (and more) were non-issues and were implemented in a clean, consistent and performant way. Unicode support rocks. Modules rock.

* The "Pythonic" way of programming is not an obvious thing to get, until you have had the chance of spending quality time (as in full blown projects, 8 hours a day) working with it. But whenever you start implementing something the way you'd do it in PHP or Java (?), and then discover how to do it "the Python way" it comes as a true revelation.

* If you're after a web development framework, you will find PHP solutions that are ok but won't make your life that much easier overall. If you'd like to focus more on your actual product but still having a high quality codebase, then what you really want is Django. And Django is really that good, only because it's written in Python. It makes use of Python idioms which make it possible to reduce the size of the product codebase without relying on black magic. Ain't no RoR or PHP-based framework.

* Python is just as good for writing desktop software, web application backend, web application front-end, administration scripts, data-mining applications, high-performance networking libraries and the list goes on and on... Python is still an interpreted language and therefore may not perform as well in some situations as its compiled alternatives. Enters Pyrex!

* PHP's documentation with its user comments rocks. Take it away and PHP would become more of a pain to learn. The Python dev crew is apparently catching up these days and the docs for 2.6 (or 3 maybe) should also support user comments I believe.

* PHP is universally recognised as the default solution for web development. Python is not and this makes it harder to get Python recognised as a valid language for a web project.

* The quality of libraries publicly available for Python is vastly superior to PHP ones (and the code is actually readable as mentioned before). Some PEAR stuff really sucks.

* I actually stopped reading any PHP development sites or blogs, apart from the official PHP.net announcements. The level of debate in the PHP community was frankly appalling a couple of years ago and I doubt it would be the opposite now. On the other hand any Python-related readings I've done so far have remained quite professional and focus on how to make things better (as opposed to the "mine is bigger" mentality some core PHP developers had/have).

So to sum it up, I'll keep using PHP for quick one-page web scripts. I am now using Python for anything big enough to be called a project, along with Django if I feel a framework is necessary.</description>
		<content:encoded><![CDATA[<p>What I have done so far in Python boils down to Django sites essentially.<br />
It goes without saying that Django is an absolute pleasure to use and using a framework like this almost makes you forget which language you are using sometimes.<br />
But anyway, with my (unfortunately) limited experience, here is my take on the PHP vs Python issue (in random order):</p>
<p>* PHP is dead simple, Python has a slight more complex learning curve.<br />
This is essentially because PHP is at heart a templating language, with other features such as the object model built on top of it, whereas Python is a general purpose language, architecture from the ground up to support.</p>
<p>* Introspection in PHP is still too limited, or at least doesn&#8217;t feel right to me, yet. I&#8217;m sure this will get improved version after version. Once again this is mainly a concern for  object-oriented codebases, and once again this comes down to the actual nature of the languages at stake: PHP is originally a template language, when 99% of Python is built on object-oriented concepts.</p>
<p>* PHP is almost entirely used for web development and is readily available in every web hosting environment. Python is also present in most web development environments, but as a normal interpreter, it is much more rare to find mod_python ready for use. It is even more rare to find web hosting environments ready for use with Django, Turbo Gears or any other popular Python webdev framework. Quite a few newish web hosting companies have setup solutions for this now though (Textdrive, Webfaction, Media Temple, Dreamhost etc can all run at least Django without a problem I believe).</p>
<p>* Python&#8217;s enforced code indentation is brilliant. It has never gotten in the way for me but it has for direct result to make any Python code readable. Many times, even in professional environments have I seen messy unreadable PHP code. I have never been able to not read easily Python code developed by third parties.</p>
<p>* PHP is still missing or mis-implementing important features which any serious development project requires. In my mind the object model still mostly sucks. Unicode support is still not there. Namespacing was dropped from PHP5 as it was considered &#8220;syntactic sugar&#8221; (I call BS). On the other hands when I started using Python I discovered all these (and more) were non-issues and were implemented in a clean, consistent and performant way. Unicode support rocks. Modules rock.</p>
<p>* The &#8220;Pythonic&#8221; way of programming is not an obvious thing to get, until you have had the chance of spending quality time (as in full blown projects, 8 hours a day) working with it. But whenever you start implementing something the way you&#8217;d do it in PHP or Java (?), and then discover how to do it &#8220;the Python way&#8221; it comes as a true revelation.</p>
<p>* If you&#8217;re after a web development framework, you will find PHP solutions that are ok but won&#8217;t make your life that much easier overall. If you&#8217;d like to focus more on your actual product but still having a high quality codebase, then what you really want is Django. And Django is really that good, only because it&#8217;s written in Python. It makes use of Python idioms which make it possible to reduce the size of the product codebase without relying on black magic. Ain&#8217;t no RoR or PHP-based framework.</p>
<p>* Python is just as good for writing desktop software, web application backend, web application front-end, administration scripts, data-mining applications, high-performance networking libraries and the list goes on and on&#8230; Python is still an interpreted language and therefore may not perform as well in some situations as its compiled alternatives. Enters Pyrex!</p>
<p>* PHP&#8217;s documentation with its user comments rocks. Take it away and PHP would become more of a pain to learn. The Python dev crew is apparently catching up these days and the docs for 2.6 (or 3 maybe) should also support user comments I believe.</p>
<p>* PHP is universally recognised as the default solution for web development. Python is not and this makes it harder to get Python recognised as a valid language for a web project.</p>
<p>* The quality of libraries publicly available for Python is vastly superior to PHP ones (and the code is actually readable as mentioned before). Some PEAR stuff really sucks.</p>
<p>* I actually stopped reading any PHP development sites or blogs, apart from the official PHP.net announcements. The level of debate in the PHP community was frankly appalling a couple of years ago and I doubt it would be the opposite now. On the other hand any Python-related readings I&#8217;ve done so far have remained quite professional and focus on how to make things better (as opposed to the &#8220;mine is bigger&#8221; mentality some core PHP developers had/have).</p>
<p>So to sum it up, I&#8217;ll keep using PHP for quick one-page web scripts. I am now using Python for anything big enough to be called a project, along with Django if I feel a framework is necessary.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Isofarro</title>
		<link>http://muffinresearch.co.uk/archives/2007/11/27/python-or-php/#comment-63725</link>
		<dc:creator>Isofarro</dc:creator>
		<pubDate>Wed, 28 Nov 2007 15:04:03 +0000</pubDate>
		<guid isPermaLink="false">http://muffinresearch.co.uk/archives/2007/11/27/python-or-php/#comment-63725</guid>
		<description>Python probably wins on RESTful APIs, better HTTP libraries, better Character encoding handling, better socket libraries. Writing this stuff in PHP is tedious and fraught with difficulty. Python just looks cleaner for building such applications.</description>
		<content:encoded><![CDATA[<p>Python probably wins on RESTful APIs, better HTTP libraries, better Character encoding handling, better socket libraries. Writing this stuff in PHP is tedious and fraught with difficulty. Python just looks cleaner for building such applications.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
