Should I learn Python?

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

    #1

    Should I learn Python?

    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.
  • bruno modulix

    #2
    Re: Should I learn Python?

    Sam a écrit :[color=blue]
    > 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?[/color]
    <troll>
    1/ Write clean, well structured, readable code,
    2/ Have Fun
    </troll>
    3/ Use Zope
    4/ Use Twisted
    5/ etc...
    [color=blue]
    > 2. Do you use both PHP and Python in conjunction with each other?[/color]
    No. I use PHP for legacy apps and really dumb scripting.
    [color=blue]
    > 3. In what way could I utilize Python to compliment existing sites or
    > apps built with PHP?[/color]
    a cgi is a cgi, whatever the language (php, perl, python, bash, C,
    COBOL, assembly....).
    [color=blue]
    > Thanks for any help.[/color]
    HTH

    Comment

    • Roy Smith

      #3
      Re: Should I learn Python?

      bruno modulix <onurb@xiludom. gro> wrote:[color=blue][color=green]
      > > 3. In what way could I utilize Python to compliment existing sites or
      > > apps built with PHP?[/color]
      > a cgi is a cgi, whatever the language (php, perl, python, bash, C,
      > COBOL, assembly....).[/color]

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

      Comment

      • M. Bitner

        #4
        Re: Should I learn Python?

        On 2 Nov 2004 13:28:22 -0800, Sam <sam@three60.co m> wrote:[color=blue]
        > 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.
        > --
        > http://mail.python.org/mailman/listinfo/python-list
        >[/color]

        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

        Comment

        • Dirkjan Ochtman

          #5
          Re: Should I learn Python?

          > 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.
          [color=blue]
          > 2. Do you use both PHP and Python in conjunction with each other?[/color]

          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).
          [color=blue]
          > 3. In what way could I utilize Python to compliment existing sites or
          > apps built with PHP?[/color]

          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

          Comment

          • Thomas Guettler

            #6
            Re: Should I learn Python?

            Am Tue, 02 Nov 2004 13:28:22 -0800 schrieb Sam:
            [color=blue]
            > 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?[/color]

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

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

            Thomas

            Comment

            • Sam

              #7
              Re: Should I learn Python?

              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

              Comment

              • Istvan Albert

                #8
                Re: Should I learn Python?

                Sam wrote:
                [color=blue]
                > Should I learn Python?[/color]

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

                You cannot write Python code in php.
                [color=blue]
                > 2. Do you use both PHP and Python in conjunction with each other?[/color]

                No and probably very few do.
                [color=blue]
                > 3. In what way could I utilize Python to compliment existing sites or
                > apps built with PHP?[/color]

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

                Istvan.

                Comment

                • Istvan Albert

                  #9
                  Re: Should I learn Python?

                  Sam wrote:
                  [color=blue]
                  > 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?[/color]

                  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.

                  Comment

                  • Cameron Laird

                    #10
                    Re: Should I learn Python?

                    In article <624a388a.04110 30512.3cf84547@ posting.google. com>,
                    Sam <sam@three60.co m> wrote:[color=blue]
                    >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[/color]

                    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.

                    Comment

                    • Larry Bates

                      #11
                      Re: Should I learn Python?

                      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.


                      Sam wrote:[color=blue]
                      > 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.[/color]

                      Comment

                      • Terry Reedy

                        #12
                        Re: Should I learn Python?

                        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



                        Comment

                        • Bruno Desthuilliers

                          #13
                          Re: Should I learn Python?

                          Sam wrote:[color=blue]
                          > 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?[/color]

                          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.
                          [color=blue]
                          > 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.[/color]

                          I apologize for being a troll.
                          [color=blue]
                          > 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?[/color]

                          Well, there's no exact answer to this question. It's not a matter of raw
                          functionnalitie s, 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).

                          [color=blue]
                          > Is there a
                          > point when learning Python, that I'll say to myself "why use php?".[/color]

                          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.

                          [color=blue]
                          > Thanks[/color]
                          You're welcome (and please forgive my trollness)
                          Bruno

                          Comment

                          • Sam

                            #14
                            Re: Should I learn Python?

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

                            Comment

                            • Y2KYZFR1

                              #15
                              Re: Should I learn Python?

                              sam@three60.com (Sam) wrote in message news:<624a388a. 0411030512.3cf8 4547@posting.go ogle.com>...[color=blue]
                              > 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[/color]

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

                              Comment

                              Working...