#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Location
    Rio de Janeiro, Brazil
    Posts
    447
    Rep Power
    11

    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.

    Peace,
    Ramon

    Comments on this post

    • wx_uab agrees
    Help my country and sign the petition in favor of OS software. See the Petition
    Linux is like sex, it's better when it's free!
  2. #2
  3. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    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.

    http://aspn.activestate.com/ASPN/Python/Cookbook/
    http://www.oreilly.com/catalog/pythoncook/

    Hope this helps,

    Mark.

    Comments on this post

    • jacktasia agrees
    programming language development: www.netytan.com Hula

  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Location
    Rio de Janeiro, Brazil
    Posts
    447
    Rep Power
    11
    Thanks for the info,

    BTW I liked this part:
    http://www.python.org/download/download_windows.html

    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?

    Thanks,
    Ramon
    Help my country and sign the petition in favor of OS software. See the Petition
    Linux is like sex, it's better when it's free!
  6. #4
  7. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    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 .

    Have fun,

    Mark.
    programming language development: www.netytan.com Hula

  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2004
    Posts
    40
    Rep Power
    10
    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.
  10. #6
  11. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Location
    Rio de Janeiro, Brazil
    Posts
    447
    Rep Power
    11
    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.

    Peace,
    Ramon
    Help my country and sign the petition in favor of OS software. See the Petition
    Linux is like sex, it's better when it's free!
  12. #7
  13. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    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.

    Take care,

    Mark.
    programming language development: www.netytan.com Hula

  14. #8
  15. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2004
    Posts
    40
    Rep Power
    10
    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 )

    ah new

IMN logo majestic logo threadwatch logo seochat tools logo