Should I learn Python?

S

Sam

Hi,
I have been developing sites and cms's for the past few years using
PHP and mysql. I've been interested in learning a new language and was
considering Python. I have a pretty decent grasp of OOP concepts (i
know, you're skeptical since I mentioned PHP). I don't have a formal
programming background, just learning as I go.

So, with that being said, here are some dumb questions.

1. What can I do with Python that I can't do with php?

2. Do you use both PHP and Python in conjunction with each other?

3. In what way could I utilize Python to compliment existing sites or
apps built with PHP?

Thanks for any help.
 
B

bruno modulix

Sam a écrit :
Hi,
I have been developing sites and cms's for the past few years using
PHP and mysql. I've been interested in learning a new language and was
considering Python. I have a pretty decent grasp of OOP concepts (i
know, you're skeptical since I mentioned PHP). I don't have a formal
programming background, just learning as I go.

So, with that being said, here are some dumb questions.

1. What can I do with Python that I can't do with php?
<troll>
1/ Write clean, well structured, readable code,
2/ Have Fun
</troll>
3/ Use Zope
4/ Use Twisted
5/ etc...
2. Do you use both PHP and Python in conjunction with each other?
No. I use PHP for legacy apps and really dumb scripting.
3. In what way could I utilize Python to compliment existing sites or
apps built with PHP?
a cgi is a cgi, whatever the language (php, perl, python, bash, C,
COBOL, assembly....).
Thanks for any help.
HTH
 
R

Roy Smith

bruno modulix said:
a cgi is a cgi, whatever the language (php, perl, python, bash, C,
COBOL, assembly....).

But there's a lot more to web applications than CGI.
 
M

M. Bitner

Hi,
I have been developing sites and cms's for the past few years using
PHP and mysql. I've been interested in learning a new language and was
considering Python. I have a pretty decent grasp of OOP concepts (i
know, you're skeptical since I mentioned PHP). I don't have a formal
programming background, just learning as I go.

So, with that being said, here are some dumb questions.

1. What can I do with Python that I can't do with php?

2. Do you use both PHP and Python in conjunction with each other?

3. In what way could I utilize Python to compliment existing sites or
apps built with PHP?

Thanks for any help.

Learning Python would be an excellent next step in your development.
Most programming textbooks recommend you learn at least one new
language a year. Python is a clean, well designed language and should
be straightforward (and fun) for you to learn.

But to answer your questions:
1. PHP is a web scripting language and Python is a general purpose
scripting language. You can use PHP outside of a web environment but
that really isn't its strong point. You can use Python pretty much
anywhere.

2. No. Where I work we have one internal app written in PHP but are
moving towards developing exclusively in Python. We have thought about
potentially using PHP for the presentation layer and Python for the
business logic but haven't gotten that far yet.

3. Where do you need it? If PHP works for your site then Python may
not be a necessary addition.

HTH,
Melissa
 
D

Dirkjan Ochtman

1. What can I do with Python that I can't do with php?

Python is a much cleaner. Its design was well thought-out, with very
good support of OOP (something which has been problematic in PHP 4).
Also, several features in Python make sure you write clean code with it,
something that is very much lacking in PHP. Finally, the library in
Python is cleanly separated and easily extensible.
2. Do you use both PHP and Python in conjunction with each other?

I've used PHP a lot, but I'm currently moving all development effort to
Python. For some projects, I think combined use could be useful (e.g. to
setup a web service of which one side is easier to do in Python, while
the other side would be easier to do in PHP).
3. In what way could I utilize Python to compliment existing sites or
apps built with PHP?

This depends on the way your applications are written. My PHP
applications are always embedded in a framework I wrote myself, and this
would make it hard to effectively extend the application in Python.

Regards,

Dirkjan
 
T

Thomas Guettler

Am Tue, 02 Nov 2004 13:28:22 -0800 schrieb Sam:
Hi,
I have been developing sites and cms's for the past few years using
PHP and mysql. I've been interested in learning a new language and was
considering Python. I have a pretty decent grasp of OOP concepts (i
know, you're skeptical since I mentioned PHP). I don't have a formal
programming background, just learning as I go.

So, with that being said, here are some dumb questions.

1. What can I do with Python that I can't do with php?

AFAIK there is no object database like ZODB (or Durus) for php.
2. Do you use both PHP and Python in conjunction with each other?

No. Only python, a little shell (bash) and calling external programms with
os.system or popen.

Thomas
 
S

Sam

So you're saying, in order to write smart, clean, well structured,
readable code, and have fun doing so, I'm going to have to drop PHP
and use Python?

I'm not really interested in finding a replacement for PHP, it works
just fine for me.

I apologize for not phrasing my questions clearly, I wasn't looking
for critisisms of PHP or why I shouldn't use it. What i'm really
after, is given that I use PHP to develop sites currently, what types
of situations would/could i use Python in web development? Is there a
point when learning Python, that I'll say to myself "why use php?".
Thanks
 
I

Istvan Albert

Sam said:
> Should I learn Python?

I think learning a new langauge every once in while can be
extremely beneficial even if one does not actually
switch to it
1. What can I do with Python that I can't do with php?

You cannot write Python code in php.
2. Do you use both PHP and Python in conjunction with each other?

No and probably very few do.
3. In what way could I utilize Python to compliment existing sites or
apps built with PHP?

Implementing more complex algorithms is a lot easier with python.
You still need a way to interface between the two though.

Istvan.
 
I

Istvan Albert

Sam said:
So you're saying, in order to write smart, clean, well structured,
readable code, and have fun doing so, I'm going to have to drop PHP
and use Python?

well yeah,

but of course it all depends on the complexity of the problem that
you have to solve.

A simple functionality, can be made into a clean, well structured readable code even
in say C shell, (I recently had to use bash, I totally forgot how frustrating and
rigid language it is ...)

Istvan.
 
C

Cameron Laird

So you're saying, in order to write smart, clean, well structured,
readable code, and have fun doing so, I'm going to have to drop PHP
and use Python?

I'm not really interested in finding a replacement for PHP, it works
just fine for me.

I apologize for not phrasing my questions clearly, I wasn't looking
for critisisms of PHP or why I shouldn't use it. What i'm really
after, is given that I use PHP to develop sites currently, what types
of situations would/could i use Python in web development? Is there a
point when learning Python, that I'll say to myself "why use php?".
Thanks

If you're happy with PHP, you'll likely stay with PHP, until you
run into an off-beat capability (Expect? scientific/numeric
programming? Does PHP build-in LDAPv3 awareness? UDP? SNMP?)
that you both need and that PHP makes painful.
 
L

Larry Bates

I also learned PHP first, but have been very happy that I
moved to Python. The OOP capabilities are no comparison
(e.g. Python is better IMHO). It is the richness of the
standard library and add-ons that make Python a good choice.
Things like ReportLab, Python Imaging Library, SMTP, FTP,
URLlib, etc.

One of my recent sites used PHP for front-end UI and Python
for backend database processing. The combination worked well
for that client. I still think that if I did it today, I would
do it all in Python, but the combination worked well. The UI
was not complex so I did it in PHP very quickly.

One very big difference is that I can do more DIFFERENT things
in Python than PHP. I can write standalone programs with Python
using wxWindows, etc. I've written COM objects, Windows Services,
plain scripts, programs that manipulate the Windows Registry,
programs that modify the NT user database, you name it. These
types of programs just don't make sense in PHP. I find that I
am able to learn one language very well instead of VB for GUI
apps, C/C++ for services/COM objects, PHP for web applications, ...

Python just addresses a wider landscape over more different
platforms for me.

Larry Bates
Syscon, Inc.
 
T

Terry Reedy

If you have not, I suggest that you spend about 2 hours reading through the
Python tutorial. The should be enough to experience whether Python grabs
you, the way it has some of us, or repels you, as it has others.

tjr
 
B

Bruno Desthuilliers

Sam said:
So you're saying, in order to write smart, clean, well structured,
readable code, and have fun doing so, I'm going to have to drop PHP
and use Python?

Err... You might not have notice, but this was enclosed in a <troll> tag !-)

You can of course write smart, clean, well structured, readable code in
PHP - it's just that's it's easier and more fun (IMVHO) to do so in Python.
I'm not really interested in finding a replacement for PHP, it works
just fine for me.

I apologize for not phrasing my questions clearly, I wasn't looking
for critisisms of PHP or why I shouldn't use it.

I apologize for being a troll.
What i'm really
after, is given that I use PHP to develop sites currently, what types
of situations would/could i use Python in web development?

Well, there's no exact answer to this question. It's not a matter of raw
functionnalities, PHP has it all (or almost, but well...). What Python
has to offer is :
- the language itself, which is IMHO cleaner, smarter and more fun
- frameworks or application servers like Zope, Twisted, Nevow etc

Zope is somewhat not easy to 'get into', but it's worth the effort, and
you can experience productivity gain even on the first project (well...
I did at least).

Is there a
point when learning Python, that I'll say to myself "why use php?".

Depends on you. I personnally still use PHP for quick&dumb stuffs like
includes, simple forms etc., cause Python itself would not buy me
anything for such things and using Zope would be overkill.

You're welcome (and please forgive my trollness)
Bruno
 
S

Sam

Thanks Bruno,
No need to apologize, just thought maybe I wasn't being clear, thanks
for your insight
 
Y

Y2KYZFR1

So you're saying, in order to write smart, clean, well structured,
readable code, and have fun doing so, I'm going to have to drop PHP
and use Python?

I'm not really interested in finding a replacement for PHP, it works
just fine for me.

I apologize for not phrasing my questions clearly, I wasn't looking
for critisisms of PHP or why I shouldn't use it. What i'm really
after, is given that I use PHP to develop sites currently, what types
of situations would/could i use Python in web development? Is there a
point when learning Python, that I'll say to myself "why use php?".
Thanks

learn python and you will answer your own question, php is just about
1 rung above perl in maintainability
 

Ask a Question

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.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,052
Latest member
LucyCarper

Latest Threads

Top