March 9th, 2005, 05:45 AM
Python vs. PHP-GTK
I would like to know the advantages I would have on Python that I can't have with PHP-GTK. (Speed, performance, stability, iteraction with mysql, sqlite? Shell/Bash interaction?)
Are there good cookbooks on python?
I like to see the example projects to get an idea of how it works to get my hands dirty.
OBS: I've read and liked the mod_python, seems very fast.
Comments on this post
March 9th, 2005, 07:40 AM
This is a Python forum so I'll have to go with python. I would go with Python regardless, but you may find the posts here a little bias. Keep that in mind .
Python excels at GUI programming and has a lot of great GUI toolkits - TKinter, wxPython and pyQT for instance. This means you won't be stuck with GTK, or on one platform since in most cases Pythons GUI toolkits will work everywhere Python does!
Pythons clear syntax also makes for much more maintainable programs and is fast enough for nearly every program you would care to write. If it's not then it can be easily extended with C to increase performance.
PHP was designed to be good for web development. Python was designed to be an good general purpose language, maybe it's just me but I think its better to use a language for the tasks it's good at . That leaved PHP firmly on the server-side IMO.
You can check out the Python cookbook online (below) but there is also a good, if not slightly outdated book from O'reilly that you might want to check out.
Hope this helps,
Comments on this post
March 9th, 2005, 12:23 PM
Thanks for the info,
BTW I liked this part:
You can run on "oldhardware" and new PC's.
Are there any restrictions on how big a project can get and how weak the pc is. Like "Java" is a heavy final program, I can't see Java programs (Specially NetBeans that's made in Java) running on a 166MHZ oldhardware.
Are there any material that you can share with me about this?
March 10th, 2005, 05:29 AM
Python programs tend to scale very well and are without a doubt less intensive than Java programs since the JVM requires more juice . Of course there will be situations when a program won't run too well on a really low end computer i.e. if your doing a lot of 3D work with PyOpenGL maybe.
It all depends on the program really; what your doing with Python and what system is trying to run it. For the most part though I would assume that the program will run fine, until you've been able to test it or someone reports a problem .
As a side note, I also like mod_python. Particularly with the rise of PSP (Python Server Pages), which promise to make it more accessible to PHP users .
March 17th, 2005, 12:23 PM
I am using both python and Php-GTK for different purposes.Python is an extremely good language with so many gui toolkits supporting it. I am using Python for writing my mech engg programs. But when it comes to database interfacing libraries, php surely has an advantage over Python. Also PHP-Gtk is still in version 1(though work for support of GTK 2 is in progress). wxPython is much better than gtk for developing GUI apps.I would recommend you to stick to Python unless u r going to work with database.
March 19th, 2005, 08:39 AM
What do you mean, is it that hard to connect to database. I've been thinking, why learn python since it's basically the C language wrapped up. Since I'm doing C in College I might as well develop in Glade and A C Studio (I've found ajunta to be nice for linux). I must admit it's tough to connect to database throw the C language.
It's way easier to connect to database throw PHP.
March 19th, 2005, 11:31 AM
Python, like Perl and likely PHP is implemented in C. I don't think its really fair to call it a C wrapper; admittedly a lot of C functions/libraries are available for Python, but the Python language brings with it improved clarity and Dev' cycles (RAD). In all fairness it is it's own language .
It's been said that: a typical Python program is around 8 times smaller than its C equivalent and 4 times smaller than its Java equivalent.
Actually it is very easy to connect to a database in Python, it's just not as easy as it is in PHP since PHP's DBI is better IMO.
March 20th, 2005, 07:33 PM
Ya, I'm agree with what netytan said, PHP DBI is more powerful than Python db API.
I was facing a problem where I cant find the way to insert an "attachment" into MySQL db from Zope page with Python code.
ps: do anyone have idea to do so? (insertion of the attachment )