L
Lad
Is anyone capable of providing Python advantages over PHP if there are
any?
Cheers,
L.
any?
Cheers,
L.
Is anyone capable of providing Python advantages over PHP if there are
any?
Lad said:Is anyone capable of providing Python advantages over PHP if there are
any?
I am also new to python but I use php for 4 years. I can tell:Lad said:Is anyone capable of providing Python advantages over PHP if there are
any?
Mage said:
I don't think so. Bad programmers are able to write bad programs in anyTim said:Good - but it hardly mentions the issue of security - which seems
like a bit of a problem for PHP at the moment.
Lad said:Is anyone capable of providing Python advantages over PHP if there are
any?
Cheers,
L.
Mage said:I don't think so. Bad programmers are able to write bad programs in any
language.
However one of the worst cases is the sql injection attack. And sql
injections must be handled neither by php nor by python but by the
programmer.
I am not sure I truly understand your question.Fredrik said:sql injection? what's your excuse for not using data binding?
Avoid them is easy with set_type($value,"integer") for integer values and
correct escaping for strings.
I am also new to python but I use php for 4 years. I can tell:
- python is more *pythonic* than php
- python has its own perfume
http://www.1976.com.tw/image/trussardi_python_uomo.jpg and it's nice.
php doesn't have any smell
- writing python programs you feel much better
in PHP, good programmers are able to write bad programs without
even noticing.
Mage said:However one of the worst cases is the sql injection attack. And sql
injections must be handled neither by php nor by python but by the
programmer.
Leif said:Mage said:However one of the worst cases is the sql injection attack. And sql
injections must be handled neither by php nor by python but by the
programmer.
But Python's DB-API (the standard way to connect to an SQL database
from Python) makes escaping SQL strings automatic. You can do this:
cursor.execute('UPDATE foo SET bar=%s WHERE id=%s', ["foo'bar", 123])
And "foo'bar" will be implicitly escaped to whatever is appropriate
for your database. How's that for Python handling SQL injection
automatically?
Simon John said:I still love Perl, it's a bit of an art form, as "there's more than one
way to do it", whereas Python usually only allows one way to do it,
which may or may not be a better mantra....
Mike said:Simon John said:I still love Perl, it's a bit of an art form, as "there's more than
one way to do it", whereas Python usually only allows one way to do
it, which may or may not be a better mantra....
The Python mantra leads to 1) less programmer overhead, and 2) faster
improvements in the language.
To be a Perl expert, you have to know which of the many ways to do
various things is the fasted under what conditions.
Why?
Python programmers
seldom have to worry about that - there's usually only one [obvious]
way to do things, so you just do it that way.
Having only one obvious way
to do things means developers only have to
worry about impact on that way when making improvements, which will
speed them up.
The problem these days is that there are now multiple ways to do a
variety of things, because we have the "new, pythonic" way and the
"old, backwards-compatible way". So it's no longer clear which is the
fastest -
and in the case of generators versus list comprehensions,
it's not clear which you should be using. To bad.
John said:Not. Perl and Java use similar methods where one can specify place holders,
and pass on the data unescaped. But still injection is possible.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.