PHP vs Python 
Author Message
 PHP vs Python

Hi
I did a quick search for deja python +php +review
not even 1 relevent hit ...so
any takers points of interest

0- how long is a peice of string ? ;)

1-which one is going to be around longer, why ??

2-who has more users

3-who hits the wall in scaling up and or handing complexity

4-general performance

5-where would I be better off using PHP over Python

6-DB interfaces consistent
   -seems python has a standad API PHP appears all over the map depending on
DB



Fri, 04 Jul 2003 09:42:34 GMT  
 PHP vs Python


Quote:
> Hi
> I did a quick search for deja python +php +review
> not even 1 relevent hit ...so
> any takers points of interest

Try including Java in that :\

Quote:

> 0- how long is a peice of string ? ;)

> 1-which one is going to be around longer, why ??

> 2-who has more users

> 3-who hits the wall in scaling up and or handing complexity

> 4-general performance

> 5-where would I be better off using PHP over Python

> 6-DB interfaces consistent
>    -seems python has a standad API PHP appears all over the map
depending on
> DB

Sent via Deja.com
http://www.deja.com/


Fri, 04 Jul 2003 11:28:20 GMT  
 PHP vs Python

Quote:

> Hi

Hi!

Quote:
> I did a quick search for deja python +php +review
> not even 1 relevent hit ...so
> any takers points of interest

> 0- how long is a peice of string ? ;)

Seven.

Quote:
> 1-which one is going to be around longer, why ??

The piece of string?  No, wait, I see.  The answer
is Python.  No argument is possible.  (Two possible
reasons, one being that Python was here first...)

Quote:
> 2-who has more users

Don't know.  Suspect it's Python, that one being
rather broader in scope ("rather" means "massively"
in my world).

Quote:
> 3-who hits the wall in scaling up and or handing complexity

PHP.

Quote:
> 4-general performance

Python is better for "general" performance,
given that PHP is not designed for "general"
use.

Quote:
> 5-where would I be better off using PHP over Python

An environment already using PHP.  Or an environment
where Python is not available.  Or if you know
only PHP.  Only sure about the first two...

Quote:
> 6-DB interfaces consistent
>    -seems python has a standad API PHP appears
>     all over the map depending on DB

Probably true.

Since you don't specify even in the slightest your
intended use for either of these languages, it must
be inferred.  Unfortunately, there are conflicting
hints.  The mere fact you are looking at PHP suggests
you are focused on web development.  On the other
hand, you do mention "general performance", implying
perhaps that you have more than a narrow application
area in mind.  Give us more info and the answers
might be useful.  I doubt mine is. :)

There is a chance, if you have a very narrow focus
on server-side web scripting in mind, that PHP
might be more suitable for you.  If that is not
your sole focus, don't waste your time.



Fri, 04 Jul 2003 12:59:31 GMT  
 PHP vs Python


                        .
                        .
                        .
Quote:
>> 2-who has more users

>Don't know.  Suspect it's Python, that one being
>rather broader in scope ("rather" means "massively"
>in my world).

No one understands the question, let
alone being certain about the answer.

This is often an obscured form for,
"How many resumes include 'PHP' vs.
'Python'?"  PHP might actually win out
on that score.

Quote:

>> 3-who hits the wall in scaling up and or handing complexity

>PHP.

Yes.  Most of the languages popularly
aggregated as "scripting" have converged
remarkably in their capabilities.  One
of the strongest differentiations,
though, is that Python handles complexity
well, and PHP is on the low end of that
particular dimension.
Quote:

>> 4-general performance

>Python is better for "general" performance,
>given that PHP is not designed for "general"
>use.

Often people asking this question mean,
"How's the CPU load when working with
Apache, IIS, and iPlanet?"  That's not
*your* idea of "general", of course, and
perhaps not even the original questioner's.
'Makes sense in Webworking circles, though.
Quote:

>> 5-where would I be better off using PHP over Python

>An environment already using PHP.  Or an environment
>where Python is not available.  Or if you know
>only PHP.  Only sure about the first two...

There will be commercial announcements
about PHP next week that will slightly
extend PHP's domain of {*filter*}.

Here's what I emphasize:  if you hang
out (are a fellow employee, for example)
with a lot of PHP enthusiasts, it's
absolutely right to go with their flow
and enjoy the advantage of their exper-
tise.
                        .
                        .
                        .
--


Business:   http://www.*-*-*.com/
Personal:   http://www.*-*-*.com/ ~claird/home.html



Fri, 04 Jul 2003 20:19:00 GMT  
 PHP vs Python

Quote:

>Hi
>I did a quick search for deja python +php +review
>not even 1 relevent hit ...so
>any takers points of interest

>0- how long is a peice of string ? ;)

n bytes where n is the number of characters in the string,
(2n bytes if it is an Unicode string)

Quote:
>1-which one is going to be around longer, why ??

>2-who has more users

from altavista :

python AND (mod_snake OR NOT snake) => 186,508 pages
php => 177,182 pages (overestimated as it's the default extension)

Quote:
>3-who hits the wall in scaling up and or handing complexity

Google didn't choose python

for feature in features:
   sucks=php.has_key(feature)
   rules=python.has_key(feature)
   if sucks and not(rules):
      if not ( feature in [ curly_braces , tags_everywhere , semicolons ] ) :
          raise SystemError
   if not(sucks) and rules:
      print feature

gives back :

exceptions
modules
great newsgroup with helpful people

Quote:
>4-general performance

The killer benchmark :

eris:~/www/cgi-bin$ cat > sucks.php
<?php
for (;;)
{
    if (mt_rand(0,1000000)==1)
        die("Got it !\n");

Quote:
}

?>

eris:~/www/cgi-bin$ time ./php < sucks.php
X-Powered-By: PHP/4.0.2
Content-type: text/html

Got it !
4.60user 14.27system 0:21.73elapsed 86%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (364major+110minor)pagefaults 0swaps

eris:~/www/cgi-bin$cat > rulez.py
import random
while random.randint(0,1000000)!=1000000:
    pass
print "Got it !"

eris:~/www/cgi-bin$ time python rulez.py
Got it !
0.00user 4.32system 0:05.44elapsed 79%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (230major+94minor)pagefaults 0swaps

I have no idea why php uses user time whereas python doesn't, a good point is that a
newbie sysadmin will believe that you aren't using much of the cpu with python as user is
0.

Quote:
>5-where would I be better off using PHP over Python

PHP is you need a web counter, Python for anything larger or if you need your counter to
be skinable.

Quote:
>6-DB interfaces consistent
>   -seems python has a standad API PHP appears all over the map depending on
>DB

<serious>

Similar APIs (their efficiency being the one of the language itself)

Personal experience : I use php for my site onesite.org, unfortunately I didn't know
python at this time, and now I'm forced to rewrite everything.

Python is a general purpose language, php is just meant to be embedded in web
pages. If you need something like me (as a mail robot, cron jobs, ...), two choices :

1. use python and be consistent, share code
2. use php on the web, and for non-web code :
   2.1  shellscripts (remove this option and come back here one month later)

   2.3  use python (and rewrite the web code in python ...)

Alain



Sat, 05 Jul 2003 05:09:34 GMT  
 PHP vs Python

Quote:


> >I did a quick search for deja python +php +review
[snip]
> >2-who has more users

> from altavista :

> python AND (mod_snake OR NOT snake) => 186,508 pages
> php => 177,182 pages (overestimated as it's the default extension)

On the topic of using search engines to compare counts
of 'users' (not that I think you were very serious :),
here's what you get from google:

'python -snake': 617,000 pages
'php': 9,990,000 pages

I'm not exactly sure what that means, and I didn't waste
my time looking beyond the first page.  I just strongly
suspect this is yet another time when the 'pages found'
count is essentially meaningless.  

I think it may mean there are a lot of pages
actually *written* with PHP, since this match probably
includes all pages with the .PHP extension...  either
that or about 10% of all web pages are on the topic
of PHP. :)



Sat, 05 Jul 2003 14:24:40 GMT  
 PHP vs Python

    [snip]

Quote:
> > python AND (mod_snake OR NOT snake) => 186,508 pages
> > php => 177,182 pages (overestimated as it's the default extension)

> On the topic of using search engines to compare counts
> of 'users' (not that I think you were very serious :),
> here's what you get from google:

> 'python -snake': 617,000 pages
> 'php': 9,990,000 pages

> I'm not exactly sure what that means, and I didn't waste
> my time looking beyond the first page.  I just strongly
> suspect this is yet another time when the 'pages found'
> count is essentially meaningless.

Searching is an art, not a science.  With Google (searching
WITH the doublequotes, an important little trick!-):

"java language"      -> 112,000
"perl language"      ->  42,500
"Pascal language"    ->   8,350
"python language"    ->   9,360
"php language"       ->   5,820
"ruby language"      ->     936
"erlang language"    ->     171

"java programming"   -> 139,000
"perl programming"   ->  69,700
"pascal programming" ->  18,800
"python programming" ->   8,290
"php programming"    ->   8,980
"ruby programming"   ->     156
"erlang programming" ->     192

"java programmer"    ->  38,300
"perl programmer"    ->  14,700
"pascal programmer"  ->   1,960
"python programmer"  ->     928
"php programmer"     ->   1,260
"ruby programmer"    ->       5
"erlang programmer"  ->      18

So, Java's cultural {*filter*} and Perl's secure second
place seem well-confirmed, with PHP and Python below
both, and Ruby and Erlang on a lower step; but from this
one can't tell within experimental error about the
relative ordering of Python and PHP, just as one can't
between Ruby and Erlang.

Anyway, here's one way to do these searches without
too much pain (a rather quick & dirty script):

import urllib, re, locale

google = " http://www.*-*-*.com/ %%22%s%%22&num=2"
numres = re.compile('of about <b>([,0-9]+)</b>')

def results(wordlist):
    query = '+'.join(wordlist)
    query_result = urllib.urlopen(google % query)
    for line in query_result.readlines():
        mo = numres.search(line)
        if mo:
            number_string = mo.group(1).replace(',','')
            return int(number_string)
    return 0

def combined(headwords, tailwords):
    longest_result = 0
    table = {}
    for head in headwords:
        table[head] = {}
        for tail in tailwords:
            result = results([head,tail])
            result = locale.format("%d",result,1)
            table[head][tail] = result
            if len(result)>longest_result:
                longest_result = len(result)
    longest_head = max(map(len,headwords))
    longest_tail = max(map(len,tailwords))
    pairs_length = longest_head+longest_tail+4
    format = '%%-%ds %%%ds' % (pairs_length, longest_result)
    for tail in tailwords:
        for head in headwords:
            pair = '"'+head+' '+tail+'"'
            hits = table[head][tail]
            print format % (pair, hits)
        print

def searcher(wordlist):
    separator = wordlist.index('+')
    combined(wordlist[:separator], wordlist[separator+1:])

if __name__=='__main__':
    import sys
    locale.setlocale(locale.LC_NUMERIC, 'US')
    searcher(sys.argv[1:])

So, for example:

D:\AWeb\pick>python sego.py tcl rexx + language programming programmer
"tcl language"      10,300
"rexx language"      3,330

"tcl programming"    2,430
"rexx programming"   2,950

"tcl programmer"       368
"rexx programmer"      149

D:\AWeb\pick>

Alex



Sat, 05 Jul 2003 20:40:45 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Php vs Python

2. php vs python

3. python resources/python vs php

4. Websh vs Rivet vs AOLServer vs PHP

5. Python VS PHP

6. Python vs PHP

7. Python vs. PHP

8. Python vs PHP

9. Python vs PHP for our rewrite?

10. Python vs PHP for our rewrite?

11. PHP+MySQL vs. PHP+PostgreSQL

12. Python Binding [Was: Re: PYTHON VS. PERL VS. TCL ]

 

 
Powered by phpBB® Forum Software