Discussion:
php-cli vs python
(too old to reply)
Abdullah Ramazanoglu
2007-06-06 22:13:03 UTC
Permalink
Hello,

I'm already (going to) use php for web based development. Shell scripting
and compiled languages have their own places, but there's also a place for
a high level scripting language. While people usually use python (for
higher level and perl for lower level tasks) for this, I really wonder
whether this would be worthwhile for me.

I have just cursory info about python, and I'm by no means a php expert. So
I can't reliably compare the two, but my rationale so far is simple: If
php5, with its enhanced object oriented features and rich libraries is on
par with python on the command line, then wouldn't it make better sense
for me to use php for both web and cli/gui development?

Nevertheless, I can't ignore the fact that people do use python almost
exclusively for high level CLI/GUI scripting. Where's the catch? What's
the top 3 killer features of python against php (and vice versa)?

Any ideas, pointers, analysis, insights are most welcome. This is a rather
strategical crossroads for me, and I'd very much like to make an informed
decision.

Thank you and kind regards.
--
Abdullah Ramazanoglu
aramazan ÄT myrealbox D0T cöm
Chris
2007-06-06 22:56:41 UTC
Permalink
Post by Abdullah Ramazanoglu
Hello,
I'm already (going to) use php for web based development. Shell scripting
and compiled languages have their own places, but there's also a place for
a high level scripting language. While people usually use python (for
higher level and perl for lower level tasks) for this, I really wonder
whether this would be worthwhile for me.
I have just cursory info about python, and I'm by no means a php expert. So
I can't reliably compare the two, but my rationale so far is simple: If
php5, with its enhanced object oriented features and rich libraries is on
par with python on the command line, then wouldn't it make better sense
for me to use php for both web and cli/gui development?
Nevertheless, I can't ignore the fact that people do use python almost
exclusively for high level CLI/GUI scripting. Where's the catch? What's
the top 3 killer features of python against php (and vice versa)?
Any ideas, pointers, analysis, insights are most welcome. This is a rather
strategical crossroads for me, and I'd very much like to make an informed
decision.
If you want to have any sort of code re-use, then you're going to have
to use php (or python) for both.

Otherwise you have to start again from scratch in python code (creating
more places for bugs to hide and making the whole thing more complicated).

While they can access the same database, there's nothing else they can
share.

Personally I'd stick to one or the other for the whole project, you'll
save yourself a lot of headaches in the future.
--
Postgresql & php tutorials
http://www.designmagick.com/
Man-wai Chang
2007-06-07 11:47:22 UTC
Permalink
Post by Chris
Otherwise you have to start again from scratch in python code (creating
more places for bugs to hide and making the whole thing more complicated).
While they can access the same database, there's nothing else they can
share.
Micro$oft expressed interest in Python. But I don't know whether it's a
trap or bait... :)
--
@~@ Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org
/ v \ Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Xubuntu 7.04) Linux 2.6.21.3
^ ^ 19:46:01 up 11 days 3:19 0 users load average: 0.00 0.00 0.00
news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk
Daniel Brown
2007-06-07 14:46:59 UTC
Permalink
Post by Man-wai Chang
Post by Chris
Otherwise you have to start again from scratch in python code (creating
more places for bugs to hide and making the whole thing more complicated).
While they can access the same database, there's nothing else they can
share.
Micro$oft expressed interest in Python. But I don't know whether it's a
trap or bait... :)
--
@~@ Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org
/ v \ Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Xubuntu 7.04) Linux 2.6.21.3
^ ^ 19:46:01 up 11 days 3:19 0 users load average: 0.00 0.00 0.00
news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Interesting reading:
http://wiki.w4py.org/python-vs-php.html
--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107
Robert Cummings
2007-06-07 15:06:17 UTC
Permalink
Post by Daniel Brown
Post by Man-wai Chang
Post by Chris
Otherwise you have to start again from scratch in python code (creating
more places for bugs to hide and making the whole thing more complicated).
While they can access the same database, there's nothing else they can
share.
Micro$oft expressed interest in Python. But I don't know whether it's a
trap or bait... :)
http://wiki.w4py.org/python-vs-php.html
They forgot a PHP pro... speed!

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
Daniel Brown
2007-06-07 15:24:40 UTC
Permalink
Post by Robert Cummings
Post by Daniel Brown
Post by Man-wai Chang
Post by Chris
Otherwise you have to start again from scratch in python code (creating
more places for bugs to hide and making the whole thing more complicated).
While they can access the same database, there's nothing else they can
share.
Micro$oft expressed interest in Python. But I don't know whether it's a
trap or bait... :)
http://wiki.w4py.org/python-vs-php.html
They forgot a PHP pro... speed!
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
They also don't touch on the extensibility, automation of
expansion with PEAR and PECL, virtually unlimited and
readily-available core modules and scripts, and the vast
implementations the world over.... but who's really paying attention,
anyway? ;-P
--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107
Richard Lynch
2007-06-09 22:47:43 UTC
Permalink
Plus, PHP has a very tiny core, and I can't imagine how Python core is
"smaller"...

./configure --disable-all

for both would be interesting...
Post by Daniel Brown
Post by Chris
Post by Daniel Brown
Post by Man-wai Chang
Post by Chris
Otherwise you have to start again from scratch in python code
(creating
Post by Daniel Brown
Post by Man-wai Chang
Post by Chris
more places for bugs to hide and making the whole thing more
complicated).
Post by Daniel Brown
Post by Man-wai Chang
Post by Chris
While they can access the same database, there's nothing else
they can
Post by Daniel Brown
Post by Man-wai Chang
Post by Chris
share.
Micro$oft expressed interest in Python. But I don't know whether
it's a
Post by Daniel Brown
Post by Man-wai Chang
trap or bait... :)
http://wiki.w4py.org/python-vs-php.html
They forgot a PHP pro... speed!
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
They also don't touch on the extensibility, automation of
expansion with PEAR and PECL, virtually unlimited and
readily-available core modules and scripts, and the vast
implementations the world over.... but who's really paying attention,
anyway? ;-P
--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
Abdullah Ramazanoglu
2007-06-07 20:10:13 UTC
Permalink
--8<--
Post by Daniel Brown
http://wiki.w4py.org/python-vs-php.html
Really interesting. It was a relief for me to see that even a somewhat
biased document written by python champions didn't reveal serious
advantages over php enough to consider dual language programming.

However, there's a general perception of php as a "web-only" language, and
all the comparisons I find -this one included- end up comparing the two as
web programming languages. What I really need is a comparison regarding
pure cli or gui projects.

I found one intersting item though: Under the "What does Python have that
PHP doesn't?" header, there's a bullet stating that "support for all major
GUI frameworks". I know that both php and python have support for gtk. Am
I to understand from this statement that python has also support for qt?

Kind regards,
--
Abdullah Ramazanoglu
aramazan ÄT myrealbox D0T cöm
Daniel Brown
2007-06-07 20:19:10 UTC
Permalink
Post by Abdullah Ramazanoglu
--8<--
Post by Daniel Brown
http://wiki.w4py.org/python-vs-php.html
Really interesting. It was a relief for me to see that even a somewhat
biased document written by python champions didn't reveal serious
advantages over php enough to consider dual language programming.
However, there's a general perception of php as a "web-only" language, and
all the comparisons I find -this one included- end up comparing the two as
web programming languages. What I really need is a comparison regarding
pure cli or gui projects.
I found one intersting item though: Under the "What does Python have that
PHP doesn't?" header, there's a bullet stating that "support for all major
GUI frameworks". I know that both php and python have support for gtk. Am
I to understand from this statement that python has also support for qt?
Kind regards,
--
Abdullah Ramazanoglu
aramazan ÄT myrealbox D0T cöm
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
If I'm not completely mistaken, I think that Python can even
interface with the GNOME libraries. PHP could theoretically do that,
as well, if someone went through and created extensions for it all.

PHP is an excellent command-line interpreter, in my opinion. I'd
say that, in all of my day-to-day PHP programming, about 60% of the
code is for the web, with 35% being run from the command line, and 5%
magically disappearing, to loud screams of frustration and broken
coffee mugs.
--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107
Robert Cummings
2007-06-07 20:31:30 UTC
Permalink
Post by Daniel Brown
If I'm not completely mistaken, I think that Python can even
interface with the GNOME libraries. PHP could theoretically do that,
as well, if someone went through and created extensions for it all.
PHP is an excellent command-line interpreter, in my opinion. I'd
say that, in all of my day-to-day PHP programming, about 60% of the
code is for the web, with 35% being run from the command line, and 5%
magically disappearing, to loud screams of frustration and broken
coffee mugs.
I had one of those little screams yesterday when I started using the
PHP's id3 lib when I realized it's crap because it can't delete or write
version 2 tags. Fortunately I found a nice user comment pointing me to
the PHP implemented getid3 lib. An hour later my mp3 collection (several
thousand ripped from my own CD collection of course :) had nice ID3 tags
based on the directories and filenames I had created a few years ago.

Wasn't an issue when I was using XMMS but I just switched to Amarok and
it makes extensive sensible use of ID3 tags :)

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
Crayon Shin Chan
2007-06-08 17:02:11 UTC
Permalink
Post by Abdullah Ramazanoglu
I found one intersting item though: Under the "What does Python have
that PHP doesn't?" header, there's a bullet stating that "support for
all major GUI frameworks". I know that both php and python have support
for gtk. Am I to understand from this statement that python has also
support for qt?
Yes, it's called PyQT. For purely non-web work Python beats PHP hands
down. Plus it runs on more platforms.
--
Crayon
Daniel Brown
2007-06-08 17:22:21 UTC
Permalink
Post by Crayon Shin Chan
Post by Abdullah Ramazanoglu
I found one intersting item though: Under the "What does Python have
that PHP doesn't?" header, there's a bullet stating that "support for
all major GUI frameworks". I know that both php and python have support
for gtk. Am I to understand from this statement that python has also
support for qt?
Yes, it's called PyQT. For purely non-web work Python beats PHP hands
down. Plus it runs on more platforms.
--
Crayon
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
I actually haven't found a platform yet that I couldn't port PHP
to, if it wasn't already native. We're talking Windows, Linux, BSD,
true *nix, MacOS, SunOS, Amiga, et cetera. I doubt it would run on my
old Commodore 64 with the 1541 5.25" floppy drive (LOAD "*",8,1), but
you can emulate a C64 in PHP (http://phpc64.extra.hu). ;-P
--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107
Crayon Shin Chan
2007-06-08 17:37:39 UTC
Permalink
Post by Daniel Brown
I actually haven't found a platform yet that I couldn't port PHP
to, if it wasn't already native. We're talking Windows, Linux, BSD,
true *nix, MacOS, SunOS, Amiga, et cetera. I doubt it would run on my
old Commodore 64 with the 1541 5.25" floppy drive (LOAD "*",8,1), but
you can emulate a C64 in PHP (http://phpc64.extra.hu). ;-P
Perhaps it would've been better to say "it is _available_ on more
platforms". No doubt given enough dedication you can probably get both
Python and PHP to _run_ on most platforms. However as an example, Python
(albeit an older version) is running happily on Nokia S60 phones, whereas
AFAIK there are no PHP running on said phones.

Also Python supports all the major GUI bindings whereas PHP only supports
GTK (AFAIK).
--
Crayon
Jochem Maas
2007-06-15 13:23:30 UTC
Permalink
Post by Crayon Shin Chan
Post by Daniel Brown
I actually haven't found a platform yet that I couldn't port PHP
to, if it wasn't already native. We're talking Windows, Linux, BSD,
true *nix, MacOS, SunOS, Amiga, et cetera. I doubt it would run on my
old Commodore 64 with the 1541 5.25" floppy drive (LOAD "*",8,1), but
you can emulate a C64 in PHP (http://phpc64.extra.hu). ;-P
Perhaps it would've been better to say "it is _available_ on more
platforms". No doubt given enough dedication you can probably get both
Python and PHP to _run_ on most platforms. However as an example, Python
(albeit an older version) is running happily on Nokia S60 phones, whereas
AFAIK there are no PHP running on said phones.
An f'ing big rant deserves to go here about f***wits that can't communicate
who spend all day staring the display of a multimedia commuication device that
and the number of people without access to clean water.

... but I can't be bothered, too busy watching a South American soap on my mobile. :-/
Post by Crayon Shin Chan
Also Python supports all the major GUI bindings whereas PHP only supports
GTK (AFAIK).
which reminds of the guy from LotusNotes fame - whose still try to build the perfect PIM
... using Python, all good and well but slow as congealed dogshit through a seive doesn't
even begin to describe it.

IT is a joke, this list is joke, I'm a joke. no joke.
Crayon Shin Chan
2007-06-15 13:34:53 UTC
Permalink
On Friday 15 June 2007 21:23, Jochem Maas wrote:

[etc]
Post by Jochem Maas
IT is a joke, this list is joke, I'm a joke. no joke.
Someone give this guy his meds :)
--
Crayon
Daniel Brown
2007-06-15 14:09:48 UTC
Permalink
Post by Crayon Shin Chan
[etc]
Post by Jochem Maas
IT is a joke, this list is joke, I'm a joke. no joke.
Someone give this guy his meds :)
--
Crayon
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Must be Friday....

And as far as a South American soap opera goes, how many people
are dressed in bumblebee suits?
--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107
Abdullah Ramazanoglu
2007-06-09 18:11:11 UTC
Permalink
Post by Crayon Shin Chan
Post by Abdullah Ramazanoglu
I found one intersting item though: Under the "What does Python have
that PHP doesn't?" header, there's a bullet stating that "support for
all major GUI frameworks". I know that both php and python have support
for gtk. Am I to understand from this statement that python has also
support for qt?
Yes, it's called PyQT. For purely non-web work Python beats PHP hands
down. Plus it runs on more platforms.
Thank you Crayon,

PyQT seems really cool (I like Qt better :)

For the part regarding Python beating PHP on the CLI/GUI, I've been
thinking about this. I might be totally wrong, but I tend to view it like
this:

In order to make a long term decision about a language, I dissect the core
language itself and its "family" (libraries, dev tools, etc. but mainly
libraries). All languages evolve, but their starting point both gives them
a head start in their particular problem domain, and also it defines how
far the language can evolve into other problem domains. E.g. it's
difficult for Perl to evolve into a PHP-like web programming language.

Now, with Python and PHP, I think both evolves into the other's problem
domain. How successful and how far they will be in doing this, might
revolve around 3 points:
1. Their core quality (language specs)
2. The distance of their starting point to the point they evolve into.
3. Library support (coupled with gaining popularity in the target domain)

As for the 1st point, I can't talk much, as I'm a Python illiterate and PHP
newbie. Nevertheless, there are subjective opinions about Python
being "beautiful", "cool", "elegant" etc. but they are not very
quantitative. I'm yet to see a quantitative solid example demonstrating
the advantages of Python against PHP regarding their core language
qualities. Admittedly, there are some annoying features of PHP, the most
annoying one being its "dynamic" typing (opposed to "weak" typing).
Sometimes I need to fight against PHP to protect my data from being
spoiled by PHP's high-level eager assumptions. But I guess it's the way
it's supposed to be in any high level language - be it PHP or Python. PHP
is not C, neither is Python.

As for the second point, PHP seems to have an advantage over Python here,
because (CLI/GUI library support aside) it's quite a decent language to
write programs for general purpose problem domain. At least it satisfies
my current expectations in that regard. So, while I find PHP core an
adequate language for general purpose programming, I don't know how
satisfying Python is in web programming domain. I know from a distance
that it has issues like lacking "safe-mode" equivalent, built-in sessions,
etc. But given enough evolution and libraries, I'm sure Python would be a
contender in web programming domain.

This brings me to the third point, library support and developer
popularity. Both feeds back the other: Library support encourages
developers to use the language in other domains, and developer popularity
(or demand) paves the way for library support to get better and better,
thus it can evolve as far as core language specs don't become a hindrance.
Currently, CLI/GUI library support for PHP is not as powerful as Python's.
I accept this and I expect this: PHP-CLI is just taking off. Currently its
usage is also low (I'm the sole bug submitter for php-newt library) but
I'm trying to see what it would be like in 5 years' time. If CLI/GUI
library support gets on par with Python's, then what's the point for me to
(fail to) master two similar languages instead of really mastering just
one?

It might be said that then I can equally start with Python, using the same
logic. True. But currently, I perceive PHP as more satisfying on the CLI
than Python on the web. So I perceive I can more successfully use PHP as a
dual domain language than Python. So, presuming that both languages will
evolve quite close to each other in the future, I can start with which one
better satisfies my current needs. That's roughly why I'm more and more in
favor of PHP. At least I think I can wait till I can justify to myself
adopting multiple similar, high-level scripting languages.

Sure, I'm concerned (much concerned) with non-web library support and
developer adoption of PHP - just like I'd have been concerned with
Python's web-support if I were going with Pyhon.

As I've said earlier, this is all IMHO, and I might be totally wrong.

Kind regards,
--
Abdullah Ramazanoglu
aramazan ÄT myrealbox D0T cöm
Nathan Nobbe
2007-06-09 18:38:38 UTC
Permalink
Post by Abdullah Ramazanoglu
Post by Abdullah Ramazanoglu
Admittedly, there are some annoying features of PHP, the most
annoying one being its "dynamic" typing (opposed to "weak" typing).

I think its worth mentioning that 'dynamic' and 'weak' typing both refer to
type checking, yet they refer to different aspects of type checking.
a lanuguage is either dynamically or statically typed and either weakly or
strongly typed, going by wikipedia:
http://en.wikipedia.org/wiki/Type_checking#Type_checking

and PHP is supposedly dynamically, weakly typed
http://en.wikipedia.org/wiki/Php

python apparently uses duck typing
http://en.wikipedia.org/wiki/Python_(programming_language)
http://en.wikipedia.org/wiki/Duck_typing

all based on wikipedia; take it or leave i guess.

anyway on the topic, ive never used python, but i run gentoo and portage is
written in python.
since i intend to dig into portage at some point, i will envitably have to
dig into to python as well.

php does have some annoyances, but i find they can almost always be handled
with a workaround even if an unattractive solution has to be implemented.
the funny thing about this topic is, i typically find myself comparing php
to java.

-nathan
Post by Abdullah Ramazanoglu
Post by Abdullah Ramazanoglu
Post by Abdullah Ramazanoglu
I found one intersting item though: Under the "What does Python have
that PHP doesn't?" header, there's a bullet stating that "support for
all major GUI frameworks". I know that both php and python have support
for gtk. Am I to understand from this statement that python has also
support for qt?
Yes, it's called PyQT. For purely non-web work Python beats PHP hands
down. Plus it runs on more platforms.
Thank you Crayon,
PyQT seems really cool (I like Qt better :)
For the part regarding Python beating PHP on the CLI/GUI, I've been
thinking about this. I might be totally wrong, but I tend to view it like
In order to make a long term decision about a language, I dissect the core
language itself and its "family" (libraries, dev tools, etc. but mainly
libraries). All languages evolve, but their starting point both gives them
a head start in their particular problem domain, and also it defines how
far the language can evolve into other problem domains. E.g. it's
difficult for Perl to evolve into a PHP-like web programming language.
Now, with Python and PHP, I think both evolves into the other's problem
domain. How successful and how far they will be in doing this, might
1. Their core quality (language specs)
2. The distance of their starting point to the point they evolve into.
3. Library support (coupled with gaining popularity in the target domain)
As for the 1st point, I can't talk much, as I'm a Python illiterate and PHP
newbie. Nevertheless, there are subjective opinions about Python
being "beautiful", "cool", "elegant" etc. but they are not very
quantitative. I'm yet to see a quantitative solid example demonstrating
the advantages of Python against PHP regarding their core language
qualities. Admittedly, there are some annoying features of PHP, the most
annoying one being its "dynamic" typing (opposed to "weak" typing).
Sometimes I need to fight against PHP to protect my data from being
spoiled by PHP's high-level eager assumptions. But I guess it's the way
it's supposed to be in any high level language - be it PHP or Python. PHP
is not C, neither is Python.
As for the second point, PHP seems to have an advantage over Python here,
because (CLI/GUI library support aside) it's quite a decent language to
write programs for general purpose problem domain. At least it satisfies
my current expectations in that regard. So, while I find PHP core an
adequate language for general purpose programming, I don't know how
satisfying Python is in web programming domain. I know from a distance
that it has issues like lacking "safe-mode" equivalent, built-in sessions,
etc. But given enough evolution and libraries, I'm sure Python would be a
contender in web programming domain.
This brings me to the third point, library support and developer
popularity. Both feeds back the other: Library support encourages
developers to use the language in other domains, and developer popularity
(or demand) paves the way for library support to get better and better,
thus it can evolve as far as core language specs don't become a hindrance.
Currently, CLI/GUI library support for PHP is not as powerful as Python's.
I accept this and I expect this: PHP-CLI is just taking off. Currently its
usage is also low (I'm the sole bug submitter for php-newt library) but
I'm trying to see what it would be like in 5 years' time. If CLI/GUI
library support gets on par with Python's, then what's the point for me to
(fail to) master two similar languages instead of really mastering just
one?
It might be said that then I can equally start with Python, using the same
logic. True. But currently, I perceive PHP as more satisfying on the CLI
than Python on the web. So I perceive I can more successfully use PHP as a
dual domain language than Python. So, presuming that both languages will
evolve quite close to each other in the future, I can start with which one
better satisfies my current needs. That's roughly why I'm more and more in
favor of PHP. At least I think I can wait till I can justify to myself
adopting multiple similar, high-level scripting languages.
Sure, I'm concerned (much concerned) with non-web library support and
developer adoption of PHP - just like I'd have been concerned with
Python's web-support if I were going with Pyhon.
As I've said earlier, this is all IMHO, and I might be totally wrong.
Kind regards,
--
Abdullah Ramazanoglu
aramazan ÄT myrealbox D0T cöm
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Abdullah Ramazanoglu
2007-06-09 21:36:14 UTC
Permalink
Post by Nathan Nobbe
Post by Abdullah Ramazanoglu
Admittedly, there are some annoying features of PHP, the most
annoying one being its "dynamic" typing (opposed to "weak" typing).
I think its worth mentioning that 'dynamic' and 'weak' typing both refer
to type checking, yet they refer to different aspects of type checking.
a lanuguage is either dynamically or statically typed and either weakly
http://en.wikipedia.org/wiki/Type_checking#Type_checking
and PHP is supposedly dynamically, weakly typed
http://en.wikipedia.org/wiki/Php
My sloppy terminology use. Still not sure about the precise terminology,
but what I meant might be called as "unavoidable dynamic casting". For
instance, I once wanted to XOR a 128 bit binary string variable with a 128
bit binary constant string. Unable to express a binary string in a
straightforward way, I resorted to "pack" it like this:

$key = pack("N*", 0x12345678, 0x9abcdef0, 0x87654321, 0x0fedcba9);

Well, second and third 32-bit hex values were automatically converted by
PHP to float, before packing, because PHP tries to cast them into signed
32-bit integers, which can't be represented with, as they're above
0x7fffffff (2^31-1). So, PHP casts them to floats. As a workaround I had
to use modulo-8 values for the top hex digits. (E.g. 0x1abcdef0 instead of
0x9abcdef0).

No way to say "Just take these bytes and pack them together, as is". Every
operation goes through PHP's own type juggling pipe. I can do explicit
casting, but not always - as in the example above. (It's possibly just my
lack of grip on PHP).

I wish PHP6 would bring along a feature to arbitrarily control or disable
dynamic casting. Without auto-casting, treating everything as byte
strings. E.g. if the user says

$x = "A" + 5;

and if auto casting is disabled, then just adding their internal
representations (0x41 + 0x05 giving 0x46) like an assembler. Sometimes I
want to take all the responsibility of disabling typing, and instruct
PHP "please do it as is, and let me worry if it makes sense or not".

Perhaps there's already a way to do this?..

Kind regards,
--
Abdullah Ramazanoglu
aramazan ÄT myrealbox D0T cöm
Abdullah Ramazanoglu
2007-06-09 22:21:01 UTC
Permalink
Post by Abdullah Ramazanoglu
$key = pack("N*", 0x12345678, 0x9abcdef0, 0x87654321, 0x0fedcba9);
Well, second and third 32-bit hex values were automatically converted by
PHP to float, before packing, because PHP tries to cast them into signed
32-bit integers, which can't be represented with, as they're above
0x7fffffff (2^31-1). So, PHP casts them to floats. As a workaround I had
to use modulo-8 values for the top hex digits. (E.g. 0x1abcdef0 instead
of 0x9abcdef0).
This is interestingly incorrect. I've just rechecked it and seen that
pack "N" works with unsigned integers as documented.

I remember it packing large (>2^31-1) integers into float, but I don't
remember my earlier test details. Obviously I've done something wrong in
my earlier trials.

Kind regards,
--
Abdullah Ramazanoglu
aramazan ÄT myrealbox D0T cöm
Man-wai Chang
2007-06-08 05:49:01 UTC
Permalink
Post by Daniel Brown
http://wiki.w4py.org/python-vs-php.html
I don't understand those python-over-php advantages at all... possibly
not important. For now, I stick with PHP.
--
.~. Might. Courage. Vision. Sincerity. http://www.linux-sxs.org
/ v \ Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Fedora Core 4) Linux 2.6.17-1.2142_FC4
^ ^ 13:48:01 up 126 days 21:32 1 user load average: 0.00 0.00 0.00
Man-wai Chang
2007-06-08 05:50:49 UTC
Permalink
Post by Man-wai Chang
Micro$oft expressed interest in Python. But I don't know whether it's a
trap or bait... :)
I said these because of Foxpro. Micro$oft bought it, improved it. But
now that Micro$oft wanan go .NET, Visual Foxpro was discontinued.

Same thing could happen to Python, since it's not a tool invented,
designed and patented by the genes of Micro$oft.
--
.~. Might. Courage. Vision. Sincerity. http://www.linux-sxs.org
/ v \ Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Fedora Core 4) Linux 2.6.17-1.2142_FC4
^ ^ 13:50:01 up 126 days 21:34 1 user load average: 0.00 0.00 0.00
Robert Cummings
2007-06-08 13:21:04 UTC
Permalink
Post by Man-wai Chang
Post by Man-wai Chang
Micro$oft expressed interest in Python. But I don't know whether it's a
trap or bait... :)
I said these because of Foxpro. Micro$oft bought it, improved it. But
now that Micro$oft wanan go .NET, Visual Foxpro was discontinued.
Same thing could happen to Python, since it's not a tool invented,
designed and patented by the genes of Micro$oft.
Does Microsoft actually invent anything?

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
Sancar Saran
2007-06-08 13:42:00 UTC
Permalink
Post by Robert Cummings
Post by Man-wai Chang
Post by Man-wai Chang
Micro$oft expressed interest in Python. But I don't know whether it's a
trap or bait... :)
I said these because of Foxpro. Micro$oft bought it, improved it. But
now that Micro$oft wanan go .NET, Visual Foxpro was discontinued.
Same thing could happen to Python, since it's not a tool invented,
designed and patented by the genes of Micro$oft.
Does Microsoft actually invent anything?
Cheers,
Rob.
Actually chair throwing invented by M$ invetion and the others "INNOVATION"...

:)

Sancar
Robert Cummings
2007-06-08 13:54:18 UTC
Permalink
Post by Sancar Saran
Post by Robert Cummings
Post by Man-wai Chang
Post by Man-wai Chang
Micro$oft expressed interest in Python. But I don't know whether it's a
trap or bait... :)
I said these because of Foxpro. Micro$oft bought it, improved it. But
now that Micro$oft wanan go .NET, Visual Foxpro was discontinued.
Same thing could happen to Python, since it's not a tool invented,
designed and patented by the genes of Micro$oft.
Does Microsoft actually invent anything?
Cheers,
Rob.
Actually chair throwing invented by M$ invetion and the others "INNOVATION"...
That's how you know Steve Ballmer is a wuss. Real men throw cabers >:)

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
Tijnema
2007-06-08 21:55:13 UTC
Permalink
Post by Robert Cummings
Post by Man-wai Chang
Post by Man-wai Chang
Micro$oft expressed interest in Python. But I don't know whether it's a
trap or bait... :)
I said these because of Foxpro. Micro$oft bought it, improved it. But
now that Micro$oft wanan go .NET, Visual Foxpro was discontinued.
Same thing could happen to Python, since it's not a tool invented,
designed and patented by the genes of Micro$oft.
Does Microsoft actually invent anything?
Cheers,
Rob.
Uhm,.. no!

It started with MSDOS, which is actually a copied version from QDOS...
And after that they only copied ideas..

Tijnema
Crayon Shin Chan
2007-06-08 16:49:51 UTC
Permalink
Post by Man-wai Chang
Post by Man-wai Chang
Micro$oft expressed interest in Python. But I don't know whether it's
a trap or bait... :)
I said these because of Foxpro. Micro$oft bought it, improved it. But
now that Micro$oft wanan go .NET, Visual Foxpro was discontinued.
Same thing could happen to Python, since it's not a tool invented,
designed and patented by the genes of Micro$oft.
The only thing M$ designed is "obsolescence builtin". But they do have a
habit of patenting things invented by others.

As with most open source projects it is simply not possible for M$
to "buy" them. Sure, they may be able to "buy" or hire the main
contributors to a particular project and influence which direction it
takes. But if interested people don't like the direction in which M$ is
taking the project they can simply fork it. IOW there is no way M$ can
embrace and extinguish an open source project. This is something that M$
has to learn. In the past they were able to destroy _really_ innovative
products by buying the company and squatting on its technology (ie kill
off all development and let it die off). For _merely_ innovative
products, M$ just stole what it needed and if its lawyers couldn't get
the owners of the stolen technology to back down, they just paid the
token fine that the courts usually imposed.
--
Crayon
Abdullah Ramazanoglu
2007-06-07 19:56:15 UTC
Permalink
--8<--
Post by Chris
Personally I'd stick to one or the other for the whole project, you'll
save yourself a lot of headaches in the future.
Thank you Chris, for the insight. The more I think about it, the closer I
get to the same conclusion. I've already made up my mind for php in web
based development. Also, I'm still unable to find a dramatic disadvantage
of php against python on the command line. What's more, I'm actually more
of a sysadmin than a dedicated application programmer. So I can't afford
to put more or less similar languages of the same league under my belt.

Kind regards,
--
Abdullah Ramazanoglu
aramazan ÄT myrealbox D0T cöm
jose javier parra sanchez
2007-06-07 15:55:01 UTC
Permalink
Hi. One big diferrence is that python can be run interactively, while
php not. That's a really good advantage to debug the scripts. Anyway,
use the one you fell more comfortable.
Post by Abdullah Ramazanoglu
Hello,
I'm already (going to) use php for web based development. Shell scripting
and compiled languages have their own places, but there's also a place for
a high level scripting language. While people usually use python (for
higher level and perl for lower level tasks) for this, I really wonder
whether this would be worthwhile for me.
I have just cursory info about python, and I'm by no means a php expert. So
I can't reliably compare the two, but my rationale so far is simple: If
php5, with its enhanced object oriented features and rich libraries is on
par with python on the command line, then wouldn't it make better sense
for me to use php for both web and cli/gui development?
Nevertheless, I can't ignore the fact that people do use python almost
exclusively for high level CLI/GUI scripting. Where's the catch? What's
the top 3 killer features of python against php (and vice versa)?
Any ideas, pointers, analysis, insights are most welcome. This is a rather
strategical crossroads for me, and I'd very much like to make an informed
decision.
Thank you and kind regards.
--
Abdullah Ramazanoglu
aramazan ÄT myrealbox D0T cöm
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Daniel Brown
2007-06-07 16:04:07 UTC
Permalink
Post by jose javier parra sanchez
Hi. One big diferrence is that python can be run interactively, while
php not. That's a really good advantage to debug the scripts. Anyway,
use the one you fell more comfortable.
Post by Abdullah Ramazanoglu
Hello,
I'm already (going to) use php for web based development. Shell scripting
and compiled languages have their own places, but there's also a place for
a high level scripting language. While people usually use python (for
higher level and perl for lower level tasks) for this, I really wonder
whether this would be worthwhile for me.
I have just cursory info about python, and I'm by no means a php expert. So
I can't reliably compare the two, but my rationale so far is simple: If
php5, with its enhanced object oriented features and rich libraries is on
par with python on the command line, then wouldn't it make better sense
for me to use php for both web and cli/gui development?
Nevertheless, I can't ignore the fact that people do use python almost
exclusively for high level CLI/GUI scripting. Where's the catch? What's
the top 3 killer features of python against php (and vice versa)?
Any ideas, pointers, analysis, insights are most welcome. This is a rather
strategical crossroads for me, and I'd very much like to make an informed
decision.
Thank you and kind regards.
--
Abdullah Ramazanoglu
aramazan ÄT myrealbox D0T cöm
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
My mistake.... I thought that's what `php -a` did.
--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107
Richard Lynch
2007-06-09 22:48:41 UTC
Permalink
Post by jose javier parra sanchez
Hi. One big diferrence is that python can be run interactively, while
php not. That's a really good advantage to debug the scripts. Anyway,
use the one you fell more comfortable.
Ummmm.

PHP has dozens of debuggers, and you can run CLI with -a to be
interactive, or with -r to run a bit of code directly.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
Richard Lynch
2007-06-09 22:43:12 UTC
Permalink
I use PHP extensively for command line processing.

Why not just try it and see if it works well for you?
Post by Abdullah Ramazanoglu
Hello,
I'm already (going to) use php for web based development. Shell scripting
and compiled languages have their own places, but there's also a place for
a high level scripting language. While people usually use python (for
higher level and perl for lower level tasks) for this, I really wonder
whether this would be worthwhile for me.
I have just cursory info about python, and I'm by no means a php expert. So
I can't reliably compare the two, but my rationale so far is simple: If
php5, with its enhanced object oriented features and rich libraries is on
par with python on the command line, then wouldn't it make better sense
for me to use php for both web and cli/gui development?
Nevertheless, I can't ignore the fact that people do use python almost
exclusively for high level CLI/GUI scripting. Where's the catch? What's
the top 3 killer features of python against php (and vice versa)?
Any ideas, pointers, analysis, insights are most welcome. This is a rather
strategical crossroads for me, and I'd very much like to make an informed
decision.
Thank you and kind regards.
--
Abdullah Ramazanoglu
aramazan ÄT myrealbox D0T cöm
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
Abdullah Ramazanoglu
2007-06-09 22:55:42 UTC
Permalink
Post by Richard Lynch
I use PHP extensively for command line processing.
Why not just try it and see if it works well for you?
I will :)
--
Abdullah Ramazanoglu
aramazan ÄT myrealbox D0T cöm
Loading...