Python vs Ruby

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

    #16
    Re: Python vs Ruby

    What languages do you know already?

    What computer science concepts do you know?

    What computer programming concepts do you know?


    Have you heard of Scheme?


    Ruby is a bit Perl like -- so if you like Perl, chances are you might
    like Ruby.

    Python is more like Java.

    I have heard, but have not been able to verify that if a program is
    about
    10,000 lines in C++
    it is about
    5,000 lines in Java
    and it is about
    3,000 lines in Python (Ruby to?)



    Roy Smith <roy@panix.co m> wrote:
    [color=blue]
    >In article <ZnD5f.636$Bf7. 280@tornado.tex as.rr.com>,
    > "Amol Vaidya" <mynewsa@gmail. com> wrote:
    >[color=green]
    >> Hi. I am interested in learning a new programming language, and have been
    >> debating whether to learn Ruby or Python. How do these compare and contrast
    >> with one another, and what advantages does one language provide over the
    >> other? I would like to consider as many opinions as I can on this matter
    >> before I start studying either language in depth. Any help/comments are
    >> greatly appreciated. Thanks in advance for your help.[/color]
    >
    >Of all the common scripting languages, Ruby has the highest vowel to
    >consonant ratio.[/color]
    --
    Regards,
    Casey

    Comment

    • Amol Vaidya

      #17
      Re: Python vs Ruby

      Thank you for all the great information and links! I think I will do what a
      lot of you reccomended and try both for myself, the only problem is finding
      time with homework, college applications, and SATs coming up. I'll let you
      know how it turns out. Again, thank you all for the help.


      Comment

      • Amol Vaidya

        #18
        Re: Python vs Ruby


        "Casey Hawthorne" <caseyhHAMMER_T IME@istar.ca> wrote in message
        news:02efl19c4n 4994vtlt2ubrs7u lg4mcm8ug@4ax.c om...[color=blue]
        > What languages do you know already?
        >
        > What computer science concepts do you know?
        >
        > What computer programming concepts do you know?
        >
        >
        > Have you heard of Scheme?
        >
        >
        > Ruby is a bit Perl like -- so if you like Perl, chances are you might
        > like Ruby.
        >
        > Python is more like Java.
        >
        > I have heard, but have not been able to verify that if a program is
        > about
        > 10,000 lines in C++
        > it is about
        > 5,000 lines in Java
        > and it is about
        > 3,000 lines in Python (Ruby to?)[/color]

        I've done a lot of studying on my own, and taken the classes that my
        high-school offers. I feel that I have a fairly good understanding of Java,
        and basic OO concepts due to that. I've created some semi-complex programs
        in java, in my opinion, such as networked checkers, 8-player blackjack, a
        space-shooter type game, a copy of mario (one level, anyway), and some other
        stuff. I've also done a bit of studying on C. I've done a few projects in C,
        including another space-shooter type of game using SDL, an IRC client and
        some simple database-type programs. I also gave a shot at assembly using
        NASM for x86 before, but didn't get too far. I wrote some trivial code --
        wrote to the video buffer, played with some bios interrupts, stuff like
        that. The only thing I did in assembly was create a program that loads at
        boot-up, and loads another program that just reiterates whatever you type
        in. I only did that because I was curious. That's about as far as my
        programming knowledge/experience goes.

        Well, I'm not sure what you mean by programming concepts. I'm familiar with
        OO through Java, and procedural programming through C. I'd be more detailed,
        but I'm not exactly sure what you are asking. Sorry.

        I have no idea what Scheme is, but I'll cettainly look it up as soon as I'm
        done writing this.

        I've never given Perl a shot. It was another language I considered learning,
        but my father's friend told me to go with Python or Ruby.

        Thanks for your help. Hopefully I wasn't too lengthy in this post.


        Comment

        • Tom Anderson

          #19
          Re: Python vs Ruby

          On Thu, 20 Oct 2005, Amol Vaidya wrote:
          [color=blue]
          > "Casey Hawthorne" <caseyhHAMMER_T IME@istar.ca> wrote in message
          > news:02efl19c4n 4994vtlt2ubrs7u lg4mcm8ug@4ax.c om...
          >[color=green]
          >> What languages do you know already? What computer science concepts do
          >> you know? What computer programming concepts do you know? Have you
          >> heard of Scheme?[/color][/color]

          Good questions!
          [color=blue][color=green]
          >> Ruby is a bit Perl like -- so if you like Perl, chances are you might
          >> like Ruby.[/color][/color]

          I don't think rubyists would appreciate that description. Ruby may be
          heavier on the funky symbols than python, but it's a very clean, elegant,
          usable, well-thought-out and deeply object-oriented language - in other
          words, nothing at all like perl.
          [color=blue][color=green]
          >> Python is more like Java.[/color][/color]

          Python is *nothing* like java.
          [color=blue][color=green]
          >> I have heard, but have not been able to verify that if a program is
          >> about
          >> 10,000 lines in C++
          >> it is about
          >> 5,000 lines in Java
          >> and it is about
          >> 3,000 lines in Python (Ruby to?)[/color][/color]

          ITYM 300. Yes, ruby too.
          [color=blue]
          > I've done a lot of studying on my own, and taken the classes that my
          > high-school offers. I feel that I have a fairly good understanding of
          > Java, and basic OO concepts due to that. I've created some semi-complex
          > programs in java, in my opinion, such as networked checkers, 8-player
          > blackjack, a space-shooter type game, a copy of mario (one level,
          > anyway), and some other stuff. I've also done a bit of studying on C.
          > I've done a few projects in C, including another space-shooter type of
          > game using SDL, an IRC client and some simple database-type programs. I
          > also gave a shot at assembly using NASM for x86 before, but didn't get
          > too far. I wrote some trivial code -- wrote to the video buffer, played
          > with some bios interrupts, stuff like that. The only thing I did in
          > assembly was create a program that loads at boot-up, and loads another
          > program that just reiterates whatever you type in. I only did that
          > because I was curious. That's about as far as my programming
          > knowledge/experience goes.[/color]

          An excellent start!
          [color=blue]
          > Well, I'm not sure what you mean by programming concepts. I'm familiar
          > with OO through Java, and procedural programming through C. I'd be more
          > detailed, but I'm not exactly sure what you are asking. Sorry.[/color]

          I think i know what Casey means, but i don't know if i can explain it any
          better. Do you understand the concept orthogonality? The Once And Only
          Once principle? Have you ever heard of design patterns?
          [color=blue]
          > I have no idea what Scheme is, but I'll cettainly look it up as soon as
          > I'm done writing this.[/color]

          You won't like it. Give yourself another 5-10 years, and you might start
          to find it strangely intriguing.
          [color=blue]
          > I've never given Perl a shot. It was another language I considered
          > learning, but my father's friend told me to go with Python or Ruby.[/color]

          Your father has good friends.
          [color=blue]
          > Thanks for your help. Hopefully I wasn't too lengthy in this post.[/color]

          Lengthy is fine!

          Anyway, the upshot of all this is that, yes, you should learn python.
          Python is dope!

          tom

          --
          NOW ALL ASS-KICKING UNTIL THE END

          Comment

          • bonono@gmail.com

            #20
            Re: Python vs Ruby

            I don't think you really need to give to much time in weighting between
            python or Ruby. Both are fine. But Python has the obvious advantage
            that it has much more modules than Ruby so many things you don't need
            to implement if you have real work to do.

            I recommend you give haskell a shot if you are "in" to programming
            because it makes you think differently, not necessary better(at least
            not all the time) but helps.

            I am not sure your intention but I think there isn't a one language
            fits all situation here. I frequently use the following:

            C/C++ - for linux kernel hacking etc., many library out there still use
            it
            python - generic stuff
            SQL - nothing beats it for many business apps
            haskell - a language to train my brain
            javascript - Web front end

            other than haskell and SQL, the others are more or less the same to me
            so getting familiar with them is not too difficult.

            Amol Vaidya wrote:[color=blue]
            > I've done a lot of studying on my own, and taken the classes that my
            > high-school offers. I feel that I have a fairly good understanding of Java,
            > and basic OO concepts due to that. I've created some semi-complex programs
            > in java, in my opinion, such as networked checkers, 8-player blackjack, a
            > space-shooter type game, a copy of mario (one level, anyway), and some other
            > stuff. I've also done a bit of studying on C. I've done a few projects in C,
            > including another space-shooter type of game using SDL, an IRC client and
            > some simple database-type programs. I also gave a shot at assembly using
            > NASM for x86 before, but didn't get too far. I wrote some trivial code --
            > wrote to the video buffer, played with some bios interrupts, stuff like
            > that. The only thing I did in assembly was create a program that loads at
            > boot-up, and loads another program that just reiterates whatever you type
            > in. I only did that because I was curious. That's about as far as my
            > programming knowledge/experience goes.
            >
            > Well, I'm not sure what you mean by programming concepts. I'm familiar with
            > OO through Java, and procedural programming through C. I'd be more detailed,
            > but I'm not exactly sure what you are asking. Sorry.
            >
            > I have no idea what Scheme is, but I'll cettainly look it up as soon as I'm
            > done writing this.
            >
            > I've never given Perl a shot. It was another language I considered learning,
            > but my father's friend told me to go with Python or Ruby.
            >
            > Thanks for your help. Hopefully I wasn't too lengthy in this post.[/color]

            Comment

            • Mike Meyer

              #21
              Re: Python vs Ruby

              "bonono@gmail.c om" <bonono@gmail.c om> writes:[color=blue]
              > I am not sure your intention but I think there isn't a one language
              > fits all situation here.[/color]

              Very true.
              [color=blue]
              > C/C++ - for linux kernel hacking etc., many library out there still use
              > it
              > python - generic stuff
              > SQL - nothing beats it for many business apps
              > haskell - a language to train my brain
              > javascript - Web front end
              >
              > other than haskell and SQL, the others are more or less the same to me
              > so getting familiar with them is not too difficult.[/color]

              There are actually lots of good "train your brain" type
              languages. Members of the LISP family, for instance, to learn what you
              can do with lists, and also for how cool a real macro facility can
              be. I happen to like Scheme, but that's just me. APL, for learning you
              can do with arrays. SNOBOL for old-school string processing and
              pattern matching. Icon for what you can do with failure. Eiffel for
              what you can do with objects and DbC. CLU for duck typing with
              declerations. Prolog for what you can do without writing commands. Oz
              includes a nice combination of a lot of these things.

              The best ones have a book associated with them that teaches general
              programming practices using said language as an example - and
              hopefully does a good job of it. I've only got four of those:

              Scheme: Structure and Interpretation of Computer Programs, by Abelson,
              Sussman and Sussman. Commonly called SICP. Available online at <URL:
              http://mitpress.mit.edu/sicp/full-text/book/book.html >.

              Oz: Concepts, Techniques and Models of Computer Programming, by Van
              Roy and Haridi. Sometimes shortened to "The Oz book." Read more about
              it at <URL: http://www2.info.ucl.ac.be/people/PVR/book.html >.

              Eiffel: Object Oriented Software Construction, by Bertrand
              Meyer. Referred to as OOSC. Read more about it at <URL:
              http://archive.eiffel.com/doc/oosc/ >.

              LISP: On LISP, by Paul Graham. Download it at <URL:
              http://www.paulgraham.com/onlisp.html >.

              The first three are books about programming that happen to use a
              specific language that supports the techniques the authors want to
              discuss. On LISP on the other hand is more about what's unique about
              LISP programming, at least when compared to more conventional
              languages. A lot of what's good about LISP is also good about Python,
              so a lot of what he has to say carries over into Python. It's also the
              only place to get a thorough look at LISP macro programming, which
              knowledge does *not* carry over into Python - but you'll understand
              why people ask for macros in Python :-).

              If you know of some book/language pair that you think everyone would
              benefit from reading, I'd be interested in hearing about them.

              <mike
              --
              Mike Meyer <mwm@mired.or g> http://www.mired.org/home/mwm/
              Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.

              Comment

              • Michele Simionato

                #22
                Re: Python vs Ruby

                Tom Anderson:[color=blue][color=green]
                >> I have no idea what Scheme is, but I'll cettainly look it up as soon as
                >> I'm done writing this.[/color][/color]
                [color=blue]
                > You won't like it. Give yourself another 5-10 years, and you might start
                > to find it strangely intriguing.[/color]

                +1 ;-)


                Michele Simionato

                Comment

                • Harald Armin  Massa

                  #23
                  Re: Python vs Ruby

                  Casey,

                  [color=blue]
                  > I have heard, but have not been able to verify that if a program is
                  > about
                  > 10,000 lines in C++
                  > it is about
                  > 5,000 lines in Java
                  > and it is about
                  > 3,000 lines in Python (Ruby to?)[/color]

                  BTW: it is normally only 50 lines in Perl. Not that you could read it,
                  though

                  Harald

                  Comment

                  • Torsten Bronger

                    #24
                    Re: Python vs Ruby

                    Hallöchen!

                    "Harald Armin Massa" <haraldarminmas sa@gmail.com> writes:
                    [color=blue]
                    > Casey,
                    >[color=green]
                    >> I have heard, but have not been able to verify that if a program is
                    >> about
                    >> 10,000 lines in C++
                    >> it is about
                    >> 5,000 lines in Java
                    >> and it is about
                    >> 3,000 lines in Python (Ruby to?)[/color]
                    >
                    > BTW: it is normally only 50 lines in Perl. Not that you could read
                    > it, though[/color]

                    At least they could form a heart.

                    Tschö,
                    Torsten.

                    --
                    Torsten Bronger, aquisgrana, europa vetus ICQ 264-296-646

                    Comment

                    • Tom Anderson

                      #25
                      Re: Python vs Ruby

                      On Thu, 20 Oct 2005, Mike Meyer wrote:
                      [color=blue]
                      > "bonono@gmail.c om" <bonono@gmail.c om> writes:
                      >[color=green]
                      >> other than haskell and SQL, the others are more or less the same to me
                      >> so getting familiar with them is not too difficult.[/color]
                      >
                      > There are actually lots of good "train your brain" type languages.
                      > Members of the LISP family, for instance, to learn what you can do with
                      > lists, and also for how cool a real macro facility can be. I happen to
                      > like Scheme, but that's just me.[/color]

                      I haven't actually done anything much in any LISP, but Scheme definitely
                      looks like a winner to me - single namespace, generally cleaned-up
                      language and library, etc.

                      tom

                      --
                      For one thing at least is almost certain about the future, namely, that very much of it will be such as we should call incredible. -- Olaf Stapledon

                      Comment

                      • Alex Stapleton

                        #26
                        Re: Python vs Ruby


                        On 21 Oct 2005, at 09:31, Harald Armin Massa wrote:
                        [color=blue]
                        > Casey,
                        >
                        >
                        >[color=green]
                        >> I have heard, but have not been able to verify that if a program is
                        >> about
                        >> 10,000 lines in C++
                        >> it is about
                        >> 5,000 lines in Java
                        >> and it is about
                        >> 3,000 lines in Python (Ruby to?)
                        >>[/color]
                        >
                        > BTW: it is normally only 50 lines in Perl. Not that you could read it,
                        > though
                        >
                        > Harald
                        >[/color]

                        Perl is more like a CISC CPU. There are a million different commands.
                        Python is more RISC like.
                        Line count comparisons = pointless.

                        Comment

                        • bruno modulix

                          #27
                          Re: Python vs Ruby

                          Amol Vaidya wrote:[color=blue]
                          > "Casey Hawthorne" <caseyhHAMMER_T IME@istar.ca> wrote in message
                          > news:02efl19c4n 4994vtlt2ubrs7u lg4mcm8ug@4ax.c om...
                          >[color=green]
                          >>What languages do you know already?
                          >>
                          >>What computer science concepts do you know?
                          >>
                          >>What computer programming concepts do you know?
                          >>
                          >>
                          >>Have you heard of Scheme?
                          >>
                          >>
                          >>Ruby is a bit Perl like -- so if you like Perl, chances are you might
                          >>like Ruby.[/color][/color]

                          Ruby is a whole lot Smalltalk-like -- so if you like Smalltalk... !-)
                          [color=blue][color=green]
                          >>Python is more like Java.[/color][/color]

                          <troll>
                          Err... Python is more like what Java would have been if Java was a smart
                          dynamic hi-level object oriented language !-)
                          </troll>
                          [color=blue][color=green]
                          >>I have heard, but have not been able to verify that if a program is
                          >>about
                          >>10,000 lines in C++
                          >>it is about
                          >>5,000 lines in Java
                          >>and it is about
                          >>3,000 lines in Python (Ruby to?)[/color][/color]

                          For a whole lot of common tasks (like file IO etc), the Java/Python loc
                          ratio is between 5/1 and 10/1. Also, not having the dumbest type system
                          in the world, Python is naturally much more generic than Java, which
                          saves a lot of boilerplate code. I think that the real numbers would be
                          much like 5000 lines in Java -> 1000 lines in Python - and probably 5000
                          -> 500 in some cases.
                          [color=blue]
                          >
                          > I've done a lot of studying on my own, and taken the classes that my
                          > high-school offers. I feel that I have a fairly good understanding of Java,
                          > and basic OO concepts due to that.[/color]

                          <IMHO>
                          Err... I wouldn't start another HolyWar, but Java is not that Object
                          Oriented. 'Class-based' would be more appropriate. Python, while not
                          being class-based (ie: it doesn't impose that all code goes into a
                          'class' statement), is much more an OO language than Java, since in
                          Python *everything* is an object - even functions, classes and modules.
                          This makes a *big* difference.

                          So yes, you may have learned some basic 00 concepts with Java (classes,
                          instances, inheritence and polymorphism), but with Python and/or Ruby,
                          you will probably realize that there's much more in the OO paradigm than
                          all the Java world can dream of.
                          </IMHO>
                          [color=blue]
                          >
                          > Well, I'm not sure what you mean by programming concepts. I'm familiar with
                          > OO through Java, and procedural programming through C. I'd be more detailed,
                          > but I'm not exactly sure what you are asking. Sorry.[/color]

                          patterns, metaclasses, aspects, closures, anonymous functions,
                          higher-order functions, multiple dispatch, properties (computed
                          attributes), generators, list expressions... does that ring a bell ?
                          [color=blue]
                          > I have no idea what Scheme is, but I'll cettainly look it up as soon as I'm
                          > done writing this.[/color]

                          Scheme is a Lisp dialect - Lisp being one of the oldest programming
                          languages, and one of the most modern programming languages. Whatever
                          the latest overhyped revolutionary new silver bullet buzzword stuff, you
                          can bet your ass Lisp already had it many years ago.

                          Now Lisp never managed to make it to the mainstream... It's a language
                          (well, a familly of languages should I say) that is worth learning, but
                          probably not until you've become familiar with some Python features and
                          idioms.

                          Another language that failed to make it to the mainstream but is worth
                          giving a try is Smalltalk - the father of OOPLs (Simula being the
                          GrandFather). BTW, most of Ruby's feature have been happily stolen from
                          Smalltalk !-)
                          [color=blue]
                          > I've never given Perl a shot. It was another language I considered learning,
                          > but my father's friend told me to go with Python or Ruby.[/color]

                          +1



                          --
                          bruno desthuilliers
                          ruby -e "print 'onurb@xiludom. gro'.split('@') .collect{|p|
                          p.split('.').co llect{|w| w.reverse}.join ('.')}.join('@' )"
                          python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
                          p in 'onurb@xiludom. gro'.split('@')])"

                          Comment

                          • Michael Ekstrand

                            #28
                            Re: Python vs Ruby

                            On Friday 21 October 2005 07:07, bruno modulix wrote:[color=blue][color=green][color=darkred]
                            > >>Python is more like Java.[/color][/color]
                            >
                            > <troll>
                            > Err... Python is more like what Java would have been if Java was a
                            > smart dynamic hi-level object oriented language !-)
                            > </troll>[/color]

                            +1. Python is easily applicable to most of the problem domain of Java,
                            but solves problems much more elegantly. It just isn't shipped embedded
                            in all leading browsers :-(.

                            - Michael

                            Comment

                            • Sion Arrowsmith

                              #29
                              Re: Python vs Ruby

                              bruno modulix <onurb@xiludom. gro> wrote:[color=blue][color=green]
                              >> "Casey Hawthorne" <caseyhHAMMER_T IME@istar.ca> wrote in message
                              >> news:02efl19c4n 4994vtlt2ubrs7u lg4mcm8ug@4ax.c om...[color=darkred]
                              >>>I have heard, but have not been able to verify that if a program is
                              >>>about
                              >>>10,000 lines in C++
                              >>>it is about
                              >>>5,000 lines in Java
                              >>>and it is about
                              >>>3,000 lines in Python (Ruby to?)[/color][/color]
                              >
                              >For a whole lot of common tasks (like file IO etc), the Java/Python loc
                              >ratio is between 5/1 and 10/1. Also, not having the dumbest type system
                              >in the world, Python is naturally much more generic than Java, which
                              >saves a lot of boilerplate code. I think that the real numbers would be
                              >much like 5000 lines in Java -> 1000 lines in Python - and probably 5000
                              >-> 500 in some cases.[/color]

                              I have here a library (it's the client side of a client-server
                              interface including a pile of class definitions) which has
                              implementations in pure C++, Java and Python, taking about 3000,
                              3500 and 1500 loc respectively. And there's an associated module
                              (with no C++ implementation) that I remember being particular
                              "impressed" while writing it to find being 3 times as long in Java
                              as Python despite (a) extensive (and pretty much common) Javadoc/
                              docstrings and (b) implementing in the Python version a feature
                              present in the standard Java library (scheduling a thread to run
                              at specified intervals and time out). Strip the Javadoc/docstrings
                              out and it's about at that 5:1 ratio.

                              As for Ruby, looking at some of the comparisons given elsewhere
                              in this thread, my intuition is that it would be more loc than
                              Python due to all the explicit end s.

                              --
                              \S -- siona@chiark.gr eenend.org.uk -- http://www.chaos.org.uk/~sion/
                              ___ | "Frankly I have no feelings towards penguins one way or the other"
                              \X/ | -- Arthur C. Clarke
                              her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump

                              Comment

                              • vdrab

                                #30
                                Re: Python vs Ruby

                                You can tell everything is well in the world of dynamic languages when
                                someone posts a question with nuclear flame war potential like "python
                                vs. ruby" and after a while people go off singing hymns about the
                                beauty of Scheme...

                                I love this place.
                                v.

                                Comment

                                Working...