Live data from Hacker News

Ask HN: Bet the farm. Python or PHP?

news.ycombinator.com

101–106 of 106 posts

Re: Ask HN: Bet the farm. Python or PHP?

#101
post #96
post #38

Earlier quoted context omitted.

If I go with PHP, Apache will be running non-threaded. To run Apache/PHP as lean as possible, I'll take advantage of thttpd's polling to quickly serve up any static content I have to as many simultaneous connections as possible. I haven't taken a really deep look at lighttpd nor nginx. I see what you mean though, why would I use two distinctly different http servers where one would simply do? Could you give me some h…

Apache buys you two things: rock-solid, time-tested stability, and millions of words of writing both online and in print about administration and tuning. Lighty and Nginx are both (like thttpd) leaner, potentially faster, and "sexier." Neither has the proven stability or community that Apache does, and neither is going to help much if your bottlenecks are at the application layer, rather than just shooting raw bits o…

Neither has the proven stability or community that Apache does

I care about the community/support aspect and you're right; I think going solely with Apache, and skipping the leaner httpd engines, is definitely a possible choice for me.

Thanks.

Re: Ask HN: Bet the farm. Python or PHP?

#102
post #52
post #25

Earlier quoted context omitted.

you don't run Django, it runs you I use Django (GeoDjango actually) at my full-time job, and love it. My progression was PHP -> Python -> TurboGears -> Pylons -> Django. I can say with confidence that it is the best of them all. Yes, many choices have been made for you, but they have been made in an elegant, Pythonic way, and you retain the ability to get under the hood to a healthy extent.

May I ask why you switched from Pylons to Django?

The real reason I switched was because I began working at a newspaper, and Django and journalism are married/fused inextricably. Choosing Pylons over Django in a news endeavor would be rather ... odd.

That aside, I said I progressed from Pylons to Django because I would choose Django if I had to do the Pylons project over again. Why? Because although I rejected (rebelled against?) it at the time, being 'forced' into an ORM for data entities would have been a really good thing. Since Pylons "lets" you shirk an ORM, I did ... but the result feels more like PHP than Python. Turns out Django's hand-holding is, in many cases, good because the answer they provide is the smart thing to do. And doesn't that sound like a description of Python itself?

Would I choose an ORM-ified Pylons experience over Django? Probably not. Django routing seems better, there's Django-enhanced unit testing, and I even prefer the way Django forces you to keep Python out of your templates in favor of "template tags" and "filters".

Perhaps most importantly, Django has nearly-impeccable documentation, and a thriving community.

Re: Ask HN: Bet the farm. Python or PHP?

#103

Earlier quoted context omitted.

The whole references thing is the biggest pain in the ass in Perl syntax. List flattening, and the fact that arrays and hashes can only store scalars (or a reference to something else), etc. just expands into every nook and cranny of the language. I still have a hard time with this aspect of the language after 10 years of Perl coding (with a three year break where I mostly worked with Python). And given how strong th…

And given how strong the tools in Perl are for working with hashes and arrays (grep, map, join, splice/unsplice, shift/unshift, sort, etc.) it really is a pain point. Not really: my $ref = [qw/foo bar baz/]; my $ref2 = [map { uc } @$ref]; # [qw/FOO BAR BAZ/] References, if anything, are just slightly ugly. I could live without non-reference values, however. They're basically useless, but sometimes they make the progr…

It's the

    @{$h{$k}}
syntax that's fugly. +1 for Python.

Re: Ask HN: Bet the farm. Python or PHP?

#104
post #38

Why two web servers (thttpd and apache) instead of just one, say lighttpd or nginx?

If I go with PHP, Apache will be running non-threaded. To run Apache/PHP as lean as possible, I'll take advantage of thttpd's polling to quickly serve up any static content I have to as many simultaneous connections as possible. I haven't taken a really deep look at lighttpd nor nginx. I see what you mean though, why would I use two distinctly different http servers where one would simply do? Could you give me some h…

nginx seems to be the "in" server with the Rails crowd.

For some things lighttpd is easier to configure than Apache and if you're running a recent version there are neat things you can do with it's lua support, e.g. http://blog.innerfence.com/2008/05/31/presto-move-content-to...

Apache is probably better for people who want to worry about their app first and their infrastructure second. After your app is under control and you have time to worry about performance and configuration then you may want to look at the others.

Then there's also other servers like Squid and thttpd. If you don't know why you would want one of them then you're probably better off not thinking about them for now. To be honest I don't know what thttpd has going for it these days. A previous company I worked for standardized on it early on and then ended up adding so much to it they would have probably been better going with Apache.

Anyone here have any good reasons to go thttpd?

Re: Ask HN: Bet the farm. Python or PHP?

#105
1. Based on content management: PHP. The biggest publishing site on the Web, Wordpress, uses it.

2. Based on libraries: PHP. You have PECL, PEAR, ezComponent, Zend and many others. Whatever you need, it has it.

3. Based on syntax: PHP. It's damn simple.

4. Based on deployment: PHP. It's fast and painless.

5. Based on execution model. PHP. mod_php, as an apache module, works and it’s scalable.

6. Based on frameworks: PHP. Symfony and Zend Framework offer a modular, MVC, loosely-couple architecture. They not only provide a solid infrastructure, but also an extensive component library.

7. Based on performance: Any, as long as you cache everything.

Good luck!

Re: Ask HN: Bet the farm. Python or PHP?

#106
post #88
post #45

Earlier quoted context omitted.

Yes, Perl encourages readability in the language by one of its language features, the helpful prefixes in front of variable names.

This is a joke, right? You can't possibly be serious.

No, I was serious.

When I look at a variable in Python, say, p, to take an example from the code shown in the Python documentation, there is no way to tell what p is. Is it an array? A dictionary? A tuple? Something else? With Perl I get more information just by looking at the variable. That makes it more readable.

Python, on the other hand, is still very nice. Maybe one of these days it will get me, especially if the libraries grow to match the breadth of CPAN.

Post reply on HN