开发者

What is the role of python on the internet? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers. 开发者_JAVA技巧

Want to improve this question? Update the question so it focuses on one problem only by editing this post.

Closed 4 years ago.

Improve this question

What is the role of python for writing dynamic web pages? Does it play an equivalent role to php?

If so, can it do all the same things as php (MySql, file manipulation, sending emails, ...)


Everything that is possible in PHP is possible in Python. I'm not sure the opposite is true. And if it is, it would require jumping hoops you don't want to jump through.

Most of the things that are laughingly easy to do in PHP for the web are not so straigtforward to do in Python (by just using the standard library). As an example making a page with a 3 field form that sends you email without any validation is pretty straightforwared in PHP compared to Python (without any framework).

For less-trivial applications that you build from scratch the numerous Python frameworks and utility libraries for web development will make your life much easier in the long run compared to if you're using anything that exists for PHP.

It's position on the web... Well, facebook is obviously not using it :)

But, companies like Disqus, Quora, Reddit, Digg, NASA and many more use it heavily for web stuff.

There's also lack of cheap (for 5 visits a day) and easy-to-deploy to hosting solutions for python applications. Although that's changing recently.


PHP is still far more common than Python as server-side language.

However, there's nothing that can be done with PHP but not with Python. There are lots of very elegant Python libraries and toolkits (especially popular as server framework is Django).

Generally, you should not be afraid to use Python if your existing infrastructure allows it (personally, I think Python's clear and expressive syntax represents a huge progress compared to PHP).


Absolutely. All those things are possible. A google search lead me to this: http://wiki.python.org/moin/WebProgramming


Good question. I had heard about python back a few years ago while getting into EVE (as they use stackless python for their language of choice), but had heard a lot about it being used for the web as well. Here's some links that I found with a quick scan of google that might of of some interest to help compare the strength and weakness's of each language. Tried to find links that presented an objective look at the comparison, but we all know how difficult that can be.

PHP vs Python - differences

Ask YC - PHP vs Python

Why PHP Is Fun and Easy But Python Is Marriage Material

Python vs PHP

C++ vs. Python vs. Perl vs. PHP performance benchmark

Benchmark: PHP vs Python vs Perl vs Ruby

Hopefully that'll help shed some light on your question.

Full disclosure: Currently develop in PHP. No practical experience with Python outside of basic tinkering.


Python's main (only?) limitation compared to PHP is its syntax. Although in most situations it doesn't matter whether you're delimiting statements and blocks with semi-colons and braces (PHP) or line breaks and indentation (Python), this does become a bit of an issue when doing templating. Templating typically requires inserting chunks of code at an indentation level dictated by the surrounding context rather than the embedded code itself. This runs very much against the grain of Python syntax.

There have been some attempts made to create a useful mapping of Python into something that can be injected into templates, but it seems that there is inevitably some loss of expressiveness. Whether the compromise is nonetheless still more powerful than PHP is another matter.


Python is a multi purpose language and not limited to the web like PHP. Numerous web frameworks like Zope, Django or Pylons are build with Python. Apart from that: Php and php-based apps have very bad security record e.g. compared to Zope-based apps.


Looks like you don't know the most basic web development uses in Python. Some web frameworks that use Python are:

  • Django

  • Flask

  • Pyramid

Some of the most popular websites also use these frameworks such as Pinterest (which uses Django). EVE was made in stackless python, a form a python used on the web. In conclusion, Python is a very reliable programming language for the web along with Ruby on Rails, Dart, Hack, PHP, Perl, and JavaScript.

EDIT: Why did I get a reputation of -2?


I think that since go-lang has gone into a release, weekly, tip release cycle, it's starting to show serious stability and it might be worth adding to this conversation. web.go, it's db connections, it's built-in http server, goinstall, ubuntu has packages already. It's website runs on it's include godoc server.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜