php vs python

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • inhahe

    #16
    Re: php vs python

    PHP can do that. There are also a number of templating engines
    available. The nice thing about PHP is you have a choice.
    i just meant that php is sort of invented to combine html and code, so if
    you use python instead you should use a templating engine. but i suppose
    it's useful for php too.


    Comment

    • Michael Fesser

      #17
      Re: php vs python

      ..oO(Nick Craig-Wood)
      >Damon Getsman <dgetsman@amire hab.netwrote:
      >PHP has great support for accessing a MySQL database,
      >
      >Actually I'd say PHP's mysql support is lacking a very important
      >feature. mysql_query() doesn't support parameters (or placeholders,
      >usually '?')
      Where were you the last couple of years? It's lacking a lot more
      features, but that's not the fault of the MySQL extension, which is
      quite old. Meanwhile we have the improved MySQL extension and PDO.
      >It is not a big deal, but I've had it drummed into me to always use
      >parameters for user input and I was really suprised PHP didn't have
      >them.
      PHP supports them since _years_, you just have to choose the right
      database interface.

      Micha

      Comment

      • Andrew Lee

        #18
        Re: php vs python

        notbob wrote:
        I'm not posting this just to initiate some religious flame war, though it's
        the perfect subject to do so. No, I actaully want some serious advice about
        these two languages and since I think usenet is the best arena to find it,
        here ya' go.
        >
        So, here's my delimna: I want to start a blog. Yeah, who doesn't. Yet, I
        want learn the guts of it instead of just booting up some wordwank or
        whatever. I started to learn python, but heard php was easier or faster or
        more like shell scripting or... fill in the blank. Anyway, so I change over
        to learning php. Then I run across that blog, Coding Horror, and start
        reading articles like this:
        >

        >
        Now what? Go back to python. Soldier on with php? What do I know? Not
        much. I can setup mysql and apache,, but don't know how to use 'em, really.
        I use emacs and run slackware and can fumble my way through bash scripts,
        but I can't really write them or do lisp. I've taken basic basic and basic
        C, but am barely literate in html. Sometimes it seems overwhelming, but I
        persevere because it's more fun/challenging than video games, which bore me
        to tears.
        >
        Well, that's my actual question, then. Is php really so bad I'm just
        wasting my time? Or is it really the quickest way to blog functionality?
        Would I be better served in the long run learning python, which claims to be
        easy as pie to learn/program (still looks hard to me). I admit I'm no code
        geek. But, I'm not completely brain dead, either, and I need something to
        keep my geezer brain sparking. What say ye?
        >
        nb
        Personally, I believe PHP would get you more productive more quickly for
        a blog, but it is a potentially brain damaging language in terms of
        really getting your juices flowing with programming. It is not a
        general purpose language and suffers from all the limitations of of a
        tool designed for one job. If you are interested in programming and the
        blog is your path to that, stick with Python! In particular, immerse
        yourself in mod_python or look at a framework like Django or Pylons --
        the learning curve is steep for any of these technologies but they are a
        full meal compared to saltine cracker and water of PHP.

        Comment

        • Erwin Moller

          #19
          Re: php vs python

          Andrew Lee schreef:
          notbob wrote:
          >I'm not posting this just to initiate some religious flame war, though
          >it's
          >the perfect subject to do so. No, I actaully want some serious advice
          >about
          >these two languages and since I think usenet is the best arena to find
          >it,
          >here ya' go.
          >>
          >So, here's my delimna: I want to start a blog. Yeah, who doesn't.
          >Yet, I
          >want learn the guts of it instead of just booting up some wordwank or
          >whatever. I started to learn python, but heard php was easier or
          >faster or
          >more like shell scripting or... fill in the blank. Anyway, so I
          >change over
          >to learning php. Then I run across that blog, Coding Horror, and start
          >reading articles like this:
          >>
          >http://www.codinghorror.com/blog/archives/001119.html
          >>
          >Now what? Go back to python. Soldier on with php? What do I know? Not
          >much. I can setup mysql and apache,, but don't know how to use 'em,
          >really.
          >I use emacs and run slackware and can fumble my way through bash scripts,
          >but I can't really write them or do lisp. I've taken basic basic and
          >basic
          >C, but am barely literate in html. Sometimes it seems overwhelming,
          >but I
          >persevere because it's more fun/challenging than video games, which
          >bore me
          >to tears.
          >Well, that's my actual question, then. Is php really so bad I'm just
          >wasting my time? Or is it really the quickest way to blog functionality?
          >Would I be better served in the long run learning python, which claims
          >to be
          >easy as pie to learn/program (still looks hard to me). I admit I'm no
          >code
          >geek. But, I'm not completely brain dead, either, and I need
          >something to
          >keep my geezer brain sparking. What say ye?
          >>
          >nb
          >
          Personally, I believe PHP would get you more productive more quickly for
          a blog, but it is a potentially brain damaging language in terms of
          really getting your juices flowing with programming. It is not a
          general purpose language and suffers from all the limitations of of a
          tool designed for one job. If you are interested in programming and the
          blog is your path to that, stick with Python! In particular, immerse
          yourself in mod_python or look at a framework like Django or Pylons --
          the learning curve is steep for any of these technologies but they are a
          full meal compared to saltine cracker and water of PHP.
          Some statement Andrew.
          Care to clarify that a little?
          I don't know much Python (aside from a little in ZOPE), but I did a lot
          of Java, Perl, VB/ASP (juck), and a little C before I learned PHP.
          I stopped using all in favor of PHP.

          If your statement says PHP is abused a lot, yes. Because it is
          relatively easy to learn for new programmers, a lot of bad PHP coders
          exist.
          But I saw them too in Java/Perl/etc.
          And I am sure you can find them too coding Python.

          It is perfectly possible to write clean good code in PHP.

          Why do you say it 'tastes less' then Python?
          I don't want to start a religious war, but am curious.
          Who knows, maybe I'll dump PHP and start using Python after your
          answer. ;-)

          Regards,
          Erwin Moller

          Comment

          • Jerry Stuckle

            #20
            Re: php vs python

            inhahe wrote:
            >PHP can do that. There are also a number of templating engines
            >available. The nice thing about PHP is you have a choice.
            >
            i just meant that php is sort of invented to combine html and code, so if
            you use python instead you should use a templating engine. but i suppose
            it's useful for php too.
            >
            >
            Not at all. With PHP, it's possible to do so, but not required. With
            Python, OTOH, you pretty much have to use a templating engine.

            --
            =============== ===
            Remove the "x" from my email address
            Jerry Stuckle
            JDS Computer Training Corp.
            jstucklex@attgl obal.net
            =============== ===

            Comment

            • Jerry Stuckle

              #21
              Re: php vs python

              Andrew Lee wrote:
              notbob wrote:
              >I'm not posting this just to initiate some religious flame war, though
              >it's
              >the perfect subject to do so. No, I actaully want some serious advice
              >about
              >these two languages and since I think usenet is the best arena to find
              >it,
              >here ya' go.
              >>
              >So, here's my delimna: I want to start a blog. Yeah, who doesn't.
              >Yet, I
              >want learn the guts of it instead of just booting up some wordwank or
              >whatever. I started to learn python, but heard php was easier or
              >faster or
              >more like shell scripting or... fill in the blank. Anyway, so I
              >change over
              >to learning php. Then I run across that blog, Coding Horror, and start
              >reading articles like this:
              >>
              >http://www.codinghorror.com/blog/archives/001119.html
              >>
              >Now what? Go back to python. Soldier on with php? What do I know? Not
              >much. I can setup mysql and apache,, but don't know how to use 'em,
              >really.
              >I use emacs and run slackware and can fumble my way through bash scripts,
              >but I can't really write them or do lisp. I've taken basic basic and
              >basic
              >C, but am barely literate in html. Sometimes it seems overwhelming,
              >but I
              >persevere because it's more fun/challenging than video games, which
              >bore me
              >to tears.
              >Well, that's my actual question, then. Is php really so bad I'm just
              >wasting my time? Or is it really the quickest way to blog functionality?
              >Would I be better served in the long run learning python, which claims
              >to be
              >easy as pie to learn/program (still looks hard to me). I admit I'm no
              >code
              >geek. But, I'm not completely brain dead, either, and I need
              >something to
              >keep my geezer brain sparking. What say ye?
              >>
              >nb
              >
              Personally, I believe PHP would get you more productive more quickly for
              a blog, but it is a potentially brain damaging language in terms of
              really getting your juices flowing with programming. It is not a
              general purpose language and suffers from all the limitations of of a
              tool designed for one job. If you are interested in programming and the
              blog is your path to that, stick with Python! In particular, immerse
              yourself in mod_python or look at a framework like Django or Pylons --
              the learning curve is steep for any of these technologies but they are a
              full meal compared to saltine cracker and water of PHP.
              And what job is that? I have a lot of batch scripts written in PHP, for
              instance.

              --
              =============== ===
              Remove the "x" from my email address
              Jerry Stuckle
              JDS Computer Training Corp.
              jstucklex@attgl obal.net
              =============== ===

              Comment

              • Michael Fesser

                #22
                Re: php vs python

                ..oO(Andrew Lee)
                >Personally, I believe PHP would get you more productive more quickly for
                >a blog, but it is a potentially brain damaging language in terms of
                >really getting your juices flowing with programming. It is not a
                >general purpose language
                Please elaborate.
                >and suffers from all the limitations of of a
                >tool designed for one job.
                Please elaborate.

                And what "one" job are you talking about? There are many things possible
                with PHP: web apps, shell scripts, daemons, GUI apps ...
                >If you are interested in programming and the
                >blog is your path to that, stick with Python!
                <flame>Where whitespace is more important than the code.</flame>

                Seriously, it's just a question of personal taste and preferences. In
                terms of capabilities there's absolutely no difference between PHP and
                Python. You need a good understanding of programming in general for
                both, the rest is just syntax and the available standard libraries.
                >In particular, immerse
                >yourself in mod_python or look at a framework like Django or Pylons --
                >the learning curve is steep for any of these technologies but they are a
                >full meal compared to saltine cracker and water of PHP.
                If you don't like PHP, that's perfectly OK. But you should accept that
                it's only a tool and just as good as the one who uses it. For me and
                many others it's a quite good language, we're able to write clean and
                efficient code with it in a rather short time.

                PHP is much more than just crackers and water. Of course you should know
                how to cook.

                Micha

                Comment

                • Duncan Booth

                  #23
                  Re: php vs python

                  Erwin Moller
                  <Since_humans_r ead_this_I_am_s pammed_too_much @spamyourself.c omwrote:
                  Why do you say it 'tastes less' then Python?
                  I don't want to start a religious war, but am curious.
                  Who knows, maybe I'll dump PHP and start using Python after your
                  answer. ;-)
                  I may not be a good person to answer this since I don't know PHP: I don't
                  have any religious objection to it, but I just never found it intuitive in
                  the way I found Python fits my mindset.

                  On those rare occasions when I've helped someone who wanted advice I've
                  found that my Python oriented viewpoint can be quite hard to translate to
                  PHP. For example I'd suggest 'oh you just encode that as utf8' only to be
                  told that there's no easy way to do that (have just Google'd it looks like
                  there is now a way to do that but with a big red warning about it being
                  EXPERIMENTAL and only use at your own risk).

                  (Looking at the example given for unicode_encode it appears to depend for
                  its working on a global setting which isn't included in the example. I may
                  have misunderstood the example but if I read that correctly its a good
                  example of why PHP doesn't fit my brain.)

                  Anyway Google should find you plenty of articles comparing the languages.
                  I'd say you use whichever feels right to you. I would also suggest you
                  should try Python at least a bit (but since I don't intend to do the same
                  for PHP you may not count my advice for much).

                  I found these pretty quickly:





                  --
                  Duncan Booth http://kupuguy.blogspot.com

                  Comment

                  • Michael Fesser

                    #24
                    Re: php vs python

                    ..oO(Duncan Booth)
                    >On those rare occasions when I've helped someone who wanted advice I've
                    >found that my Python oriented viewpoint can be quite hard to translate to
                    >PHP. For example I'd suggest 'oh you just encode that as utf8' only to be
                    >told that there's no easy way to do that (have just Google'd it looks like
                    >there is now a way to do that but with a big red warning about it being
                    >EXPERIMENTAL and only use at your own risk).
                    >
                    >(Looking at the example given for unicode_encode it appears to depend for
                    >its working on a global setting which isn't included in the example. I may
                    >have misunderstood the example but if I read that correctly its a good
                    >example of why PHP doesn't fit my brain.)
                    The only little problem is that PHP doesn't have native Unicode support
                    yet, which will change with PHP 6. But of course you can still use UTF-8
                    without any trouble, I do it all the time. You just have to keep in mind
                    that many string functions still work on bytes, not on characters, but
                    this can almost always be solved with the Multibyte extension. Apart
                    from that there's no problem with PHP and UTF-8. It's also easily
                    possible to convert between various encodings using the iconv extension.

                    Micha

                    Comment

                    • Duncan Booth

                      #25
                      Re: php vs python

                      Michael Fesser <netizen@gmx.de wrote:
                      .oO(Duncan Booth)
                      >
                      >>On those rare occasions when I've helped someone who wanted advice
                      >>I've found that my Python oriented viewpoint can be quite hard to
                      >>translate to PHP. For example I'd suggest 'oh you just encode that as
                      >>utf8' only to be told that there's no easy way to do that (have just
                      >>Google'd it looks like there is now a way to do that but with a big
                      >>red warning about it being EXPERIMENTAL and only use at your own
                      >>risk).
                      >>
                      >>(Looking at the example given for unicode_encode it appears to depend
                      >>for its working on a global setting which isn't included in the
                      >>example. I may have misunderstood the example but if I read that
                      >>correctly its a good example of why PHP doesn't fit my brain.)
                      >
                      The only little problem is that PHP doesn't have native Unicode
                      support yet, which will change with PHP 6. But of course you can still
                      use UTF-8 without any trouble, I do it all the time. You just have to
                      keep in mind that many string functions still work on bytes, not on
                      characters, but this can almost always be solved with the Multibyte
                      extension. Apart from that there's no problem with PHP and UTF-8. It's
                      also easily possible to convert between various encodings using the
                      iconv extension.
                      >
                      As I remember it the problem was that the data was stored in a database
                      in latin-1 but the HTML page had to be in utf-8 (because the rest of the
                      server and therefore all the page skins were already in utf-8). In
                      python that would be a trivial conversion but I was told that in PHP it
                      wasn't.

                      Also it was PHP4 and as I understand it updating to a more recent
                      version was non-trivial. Of course sometimes updating Python code to a
                      newer version is also non-trivial: Zope in particular is very version
                      specific but in most cases anything written in pure Python will be
                      compatible with more recent versions.

                      But one small example isn't really the point. It's that the whole way
                      Python works seems *to me* to make sense and (mostly) fits together
                      cleanly and consistently. YMMV

                      --
                      Duncan Booth http://kupuguy.blogspot.com

                      Comment

                      • Michael Fesser

                        #26
                        Re: php vs python

                        ..oO(Duncan Booth)
                        >Michael Fesser <netizen@gmx.de wrote:
                        >
                        >The only little problem is that PHP doesn't have native Unicode
                        >support yet, which will change with PHP 6. But of course you can still
                        >use UTF-8 without any trouble, I do it all the time. You just have to
                        >keep in mind that many string functions still work on bytes, not on
                        >characters, but this can almost always be solved with the Multibyte
                        >extension. Apart from that there's no problem with PHP and UTF-8. It's
                        >also easily possible to convert between various encodings using the
                        >iconv extension.
                        >>
                        >As I remember it the problem was that the data was stored in a database
                        >in latin-1 but the HTML page had to be in utf-8 (because the rest of the
                        >server and therefore all the page skins were already in utf-8). In
                        >python that would be a trivial conversion but I was told that in PHP it
                        >wasn't.
                        It would have been trivial in PHP as well, assuming the DB was MySQL,
                        which could have done this conversion automatically when sending the
                        data to the script.
                        >But one small example isn't really the point. It's that the whole way
                        >Python works seems *to me* to make sense and (mostly) fits together
                        >cleanly and consistently. YMMV
                        Fair enough. The nature of PHP as being a grown language has its
                        advantages, but also a lot of drawbacks, which are hard to solve.

                        Micha

                        Comment

                        • Arnaud Delobelle

                          #27
                          Re: php vs python

                          Michael Fesser <netizen@gmx.de writes:
                          you don't like PHP, that's perfectly OK. But you should accept that
                          it's only a tool and just as good as the one who uses it. For me and
                          many others it's a quite good language, we're able to write clean and
                          efficient code with it in a rather short time.
                          I'm sure that anyone who is competent enough can write clean code in
                          any language (in the case of PHP, I am only familiar with one
                          significant example: I use and have written a few simple extensions
                          for mediawiki, and I find it quite easy to understand and navigate the
                          code).

                          However, while I feel that most languages are quite neutral about
                          this, I find that Python *encourages* me to write better code. In
                          other words, Python is not only a tool, it's also a lovely language.

                          Languages are a bit like shoes. You probably wouldn't want to wear the pair
                          I'm most comfortable in!

                          --
                          Arnaud

                          Comment

                          • Lie

                            #28
                            Re: php vs python

                            On May 22, 12:28 pm, NC <n...@iname.com wrote:
                            On May 21, 1:10 pm, notbob <not...@nothome .comwrote:
                            >
                            >
                            >
                            So, here's my delimna: I want to start a blog.  Yeah, who doesn't.
                            Yet, I want learn the guts of it instead of just booting up some
                            wordwank or whatever.
                            >
                            Here's a simple computation to consider...  WordPress' codebase is
                            approximately a megabyte of PHP code and megabyte of JavaScript code.
                            Assuming that the average line of that code is 50 characters long, you
                            are looking at 20,000 lines of code in PHP and as many in JavaScript.
                            Based on the notion that the average developer out there writes 100
                            lines a day, either you're in for a two-year project or your product
                            is going to have seriously reduced functionality compared to something
                            that's been freely available for years.  What's your choice?
                            Nope, the core functionality of a blogging software could be
                            replicated in just a few lines of PHP codes, in the range of tens to
                            hundreds of lines. If you're creating your own blogging software, you
                            wouldn't seriously think you'd recreate all those things such as
                            pingbacks, commenting system, etc, etc, etc. No, you'd start with some
                            basic core functionalities : a few simple server side includes only.

                            Comment

                            • Lie

                              #29
                              Re: php vs python

                              On May 22, 3:10 am, notbob <not...@nothome .comwrote:
                              I'm not posting this just to initiate some religious flame war, though it's
                              the perfect subject to do so.  No, I actaully want some serious advice about
                              these two languages and since I think usenet is the best arena to find it,
                              here ya' go.
                              >
                              So, here's my delimna: I want to start a blog.  Yeah, who doesn't.  Yet, I
                              want learn the guts of it instead of just booting up some wordwank or
                              whatever.  I started to learn python, but heard php was easier or fasteror
                              more like shell scripting or... fill in the blank.  Anyway, so I change over
                              to learning php.  Then I run across that blog, Coding Horror, and start
                              reading articles like this:
                              >

                              >
                              Now what?  Go back to python.  Soldier on with php?  What do I know? Not
                              much.  I can setup mysql and apache,, but don't know how to use 'em, really.
                              I use emacs and run slackware and can fumble my way through bash scripts,
                              but I can't really write them or do lisp.  I've taken basic basic and basic
                              C, but am barely literate in html.  Sometimes it seems overwhelming, butI
                              persevere because it's more fun/challenging than video games, which bore me
                              to tears.  
                              >
                              Well, that's my actual question, then.  Is php really so bad I'm just
                              wasting my time?  Or is it really the quickest way to blog functionality?
                              Would I be better served in the long run learning python, which claims to be
                              easy as pie to learn/program (still looks hard to me).  I admit I'm no code
                              geek.  But, I'm not completely brain dead, either, and I need something to
                              keep my geezer brain sparking.  What say ye?
                              >
                              nb
                              My advice? Mix a bit of both. PHP's pros is it's tight integration
                              with HTML, it's really easy to slip small, short PHP snippets here and
                              there. Server side includes for example, is a short one-liner, in
                              python it would involve reading the original file, finding where and
                              what to slip, then reading the include file then concatenates the
                              files then send it to the requester, or you could setup an engine for
                              you which might take some time and patience.

                              On the other hand, python is a general-purpose language, and is a
                              better designed language. Writing the blog back-end in Python is
                              probably easier than in PHP while writing the interface-related codes
                              is probably easier in PHP. You might also consider calling python code
                              from the PHP.

                              Comment

                              • Jerry Stuckle

                                #30
                                Re: php vs python

                                Lie wrote:
                                On May 22, 12:28 pm, NC <n...@iname.com wrote:
                                >On May 21, 1:10 pm, notbob <not...@nothome .comwrote:
                                >>
                                >>
                                >>
                                >>So, here's my delimna: I want to start a blog. Yeah, who doesn't.
                                >>Yet, I want learn the guts of it instead of just booting up some
                                >>wordwank or whatever.
                                >Here's a simple computation to consider... WordPress' codebase is
                                >approximatel y a megabyte of PHP code and megabyte of JavaScript code.
                                >Assuming that the average line of that code is 50 characters long, you
                                >are looking at 20,000 lines of code in PHP and as many in JavaScript.
                                >Based on the notion that the average developer out there writes 100
                                >lines a day, either you're in for a two-year project or your product
                                >is going to have seriously reduced functionality compared to something
                                >that's been freely available for years. What's your choice?
                                >
                                Nope, the core functionality of a blogging software could be
                                replicated in just a few lines of PHP codes, in the range of tens to
                                hundreds of lines. If you're creating your own blogging software, you
                                wouldn't seriously think you'd recreate all those things such as
                                pingbacks, commenting system, etc, etc, etc. No, you'd start with some
                                basic core functionalities : a few simple server side includes only.
                                As he said - it's either a two man-year project or your product is going
                                to have seriously reduced functionality. It looks like you are opting
                                for the latter.

                                Also, you still need to write the server-side includes. But they won't
                                do nearly enough for everything WordPress does.

                                --
                                =============== ===
                                Remove the "x" from my email address
                                Jerry Stuckle
                                JDS Computer Training Corp.
                                jstucklex@attgl obal.net
                                =============== ===

                                Comment

                                Working...