51CTO sincerely invites you to talk with experts of Miaopai/Gome/Meituanyuan about the optimization of intelligent CDN on September 23, hurry up!


Recently I was thinking about learning a back-end language and hesitated between Ruby and Python. Then I did some comparisons myself, hoping to help you with the same problem.

1. Comparison and selection of similarities and differences

1. Similarities between Python and Ruby:

  • Both emphasize simple grammar and have more general expressions. Python is indent, ruby is basic-like expression. Have drastically reduced the number of signs.
  • Both are dynamic data types. Both have rich data structures.
  • Both have C language extensibility and are portable, much more so than Perl. They can also be used as embedded languages.
  • Both are object-oriented languages and can be used as development tools for large projects.
  • Both have rich library support.
  • There are also the most relaxed copyright licenses, except for some tools belonging to the GNU world.
  • Both have lisp-specific eval functions, and both can take functions as arguments.
  • There is also a special editor for Graphical interfaces in Ruby.
  • Both are supported by extensive C libraries. For example, QT, GTK, TK, SDL, FOX, etc. Ruby plans to implement SWIG interface.
  • They are well documented.

2. Ruby’s advantages over Python:

Regular expressions and HTML embedded functions. Python also has regular expressions, but they are not as convenient or widely used as Ruby. The embedded HTML project in Python is just getting started. Ruby and Apache mod modules. Ruby itself is also implemented with many Unix tools such as RACC and DocTools. Closer to Linux than Python.

  • Object-oriented syntax with more complete features than Python.
  • Ruby’s entire library is structured with class inheritance.
  • Its basic data types and operators are overloadable.
  • Ruby’s main functionality is implemented through method calls to objects, not functions. Python is also moving in this direction, but not as far as Ruby.
  • Ruby classes are more formal single-inheritance, with implementations of concepts such as interfaces.
  • Python can implement conditional statements and looping statements in lists, whereas Ruby implements this in a “block” way, which is more flexible and versatile than Python.
  • Ruby has lisp-like, thoroughly functional conditional statements, looping statements, and so on. Statements are more expressive.
  • Some Unix tools, such as RACC, come with it.

3. Ruby’s weaknesses compared to Python:

  • The biggest disadvantage is caused by ruby’s power. It’s not as simple as Python. More complex object-oriented syntax, the introduction of “block” syntax, regular expressions, and some shorthand markup all add to the complexity of the language.
  • Python’s indentation is more pleasing to the eye than Ruby’s Basic, and ruby programs’ eye-full ends are uncomfortable. Of course, Ruby considers the end approach to be more advanced than Python.
  • Ruby does not yet have Python’s ability to “introspect” and generate documentation from program files.
  • Ruby has no support for internationalization. Internationalization support is planned for Ruby. This is because Ruby has a shorter history than Python.
  • There is nothing like Jython in Ruby.

4. Python and Ruby:

In the sense that simple is good, Python is the right choice. Python is suitable for people looking for simple languages, which is likely to make Python more popular and therefore more supported. But if you’re looking for more powerful syntactic capabilities, Ruby is a good choice. Because ruby and Python have a lot of similarities in philosophy, start with Python, try python, if python is not enough, go to Ruby.

Comparison between Ruby and Python is like comparison between Wubi and Pinyin input method. Pinyin works fine as an input method for beginners and as an input method for long-term use. Wubi is suitable for more demanding situations. If you’re looking for performance, try Ruby. People who are interested in programming languages and want to understand various programming concepts will also be excited to learn Ruby.

Two, both have their own characteristics:

1. Python is syntactically more rustic while Ruby is sexier

Compared with other scripting languages, the syntax of Python is a little more rigid. In fact, the mandatory indentation of Python code can be seen as Guido’s design language orientation. The rigid side of the syntax is that it’s hard to do sexy things, like Rails, and Python can’t do DSL, but the rigid side of the syntax is that it’s more formal, more adaptable to the engineering requirements of software development, and easier to organize large teams to develop.

Ruby’s syntax is very flexible, and Matz designed Ruby for coding for fun, so you can do a lot of things with Ruby, and with enough skill, you can write DSLS in Ruby that approximate natural language, and it’s really fun for programmers to play with Ruby. The birth of Rails in the Ruby community and not in the Python community is absolutely directly related to the programming language. But the flipside of Ruby’s syntactic flexibility is the variety of programming implementation styles that can be a challenge for large teams to collaborate and manage.

2. Python’s parser implementation is more mature and third-party libraries are of high quality

The Ruby1.9 parser, despite the significant performance improvements and many new features, is basically enhanced by making patch in Ruby1.8 source code from a source code implementation perspective. In terms of source code structure, Ruby’s implementation is so old that Ruby is difficult to extend and can only be patched. This is why there are so many new Ruby parser implementations in the Ruby community today. To a large extent, this has limited Ruby’s growth. Python parsers are relatively mature and stable.

Ruby is not less than Python in terms of the number of third party libraries, but Python has more high performance, high quality and proven third party libraries than Ruby. In fact, many Ruby third party libraries are not mature, so this also greatly restricts the development of Ruby.

3. Python is widely used, while Ruby is currently limited to the Web

In addition to Web development, Python is also widely used in high-performance server implementation at the back end of the server, a variety of intensive computing, full text retrieval, text processing, system management, etc. In addition to desktop applications, wxPython is also a very mature cross-platform GUI framework. Python also works well for special applications, such as calling OS kernel apis, such as a real-time synchronization scheme for large numbers of small files, which is implemented by directly calling the linuxKernel’s inotify feature. So Python is the Swiss Army knife of software development. You can do anything.

Due to the limitation of Ruby parser and Ruby class library, Ruby application is mainly limited in the field of Web development. Currently, Ruby application cannot be extended to many places outside the field of Web development. Douban reportedly considered Ruby on Rails early on, but abandoned Ruby in favor of Python because Ruby couldn’t do anything else.

Ruby is king on the Web

With the further penetration of Internet application into the software development of various fields, in fact, Web development of the entire software industry development is more and more large proportion. Although Ruby is very limited in other areas, it is the absolute king in Web development. The Rails framework is far ahead of any of its potential competitors. So while Ruby may have its problems, Rails is pretty much the only undisputed choice when it comes to Web development.

Python, for all its versatility, is poorly represented in the web development world. Web frameworks abound, but none of them really stand out, and Django, while popular in the Python community, is flawed in many ways. Today’s Web applications are often written in a mix of languages, and What Ruby lacks outside the Web can be made up for in other languages.

Python’s package management is not as good as Ruby’s

Although Python’s third-party libraries are of higher quality and more mature, the Python community lacks Ruby Gem, a good package management software and package distribution site. As a result, applications are not as easy or user-friendly to build as Ruby. Especially in the class library version upgrade, there is a lot of trouble, not as easy as Ruby Gem.

Overall, though, Python and Ruby are very similar programming languages, and it wouldn’t take much time to learn both. If I personally choose, I would start with Rails to build web applications, and then choose Python or Java to handle some of the server-side computing, depending on the situation. In short, the future is still a hybrid programming era, we need to learn more about programming tools, and then eat according to the needs of the food.

Correction of ruby and Python comparison

Documentation, open source projects, library support — Ruby is not a Python problem, not a few orders of magnitude.

It’s true that Python didn’t build the regular expression module into the core, but it did have support from the RE library, which was designed to keep the core as small as possible. I’m not sure what’s the difference, or even an advantage, between using a standard library and built-in? And using regular expressions in Python is nothing more than an array of importre and a few letters of the call, saving countless ends to offset this problem.

As for embedding HTML, Python has C/Python dual-implementation Cheetah templates available, which are reportedly used by the US Navy and the French government thanks to Zope. How mature is Ruby?

The mod_Ruby module has been around for a very short time, so if you haven’t heard of Mod_Python, you don’t know much about it. When I translated the mod_PYTHon3.2.8 document a year ago, mod_python was so mature that almost all Python. WEB frameworks support building on top of it for efficiency. However, it seems that mod_Ruby is only updated a few times a year. Mod_python has a heavyweight application like gnu.org. I wonder if mod_Ruby has one?

Also, mention Unix tools. The Red Hat Linux installation program has always been written in Python, and if you happen to use Ubuntu, the program that prompts you to update your system is also written in Python.

Please forgive my ignorance about RACC and DocTools. I googled and found few Articles about RACC in Chinese except for your article. After much searching, I found a tool similar to YACC. From Google’s point of view, I won’t go into the usability of racC. I’m not sure how useful a yACC tool can be in everyday programming, but since the author mentioned it, I found a Spark that I had only heard of and never used. Google’s result is “ACCRuby” : “pythonSpark” =159,000:659,000. As for DocTools, I have nothing to say. With only 15,800 records on Google, I still can’t figure out what it does. So I looked for something similar, Docutils, and Google recorded 25,400.

“More complete object-oriented syntax than Python libraries”. What is the purpose of object orientation? Or is ruby like Python, where most standard libraries don’t need to look up documentation at all, and you can just guess the general name, dir(), and help(), and write it out the second time because there’s too little in the module to remember? Additionally, object orientation is neither a silver bullet nor the most advanced software engineering idea.

“Ruby’s entire library is class inheritance structure”, I think it is Java dross, but when chengbao learned. Perhaps this is one of the advantages ruby has come to the rescue of Java programmers.

“Basic data types and operators are overloadable”. It is not clear whether overloading __add__ counts in Python.

Ruby’s main functionality is achieved through method calls to objects, not functions. Everything in Python is an object, but not a class. In addition, recommend you do not too pursue what thorough, or practical this word is more attractive.

Python does not strictly require single inheritance to give the programmer flexibility. On the other hand, when it comes to interfaces, in Python you only have to define functions with the same name to even have the same interface. Metaphysics has risen to this level, and I’m a little confused. As for interfaces, don’t be so confident. Ruby’s interface is nothing more than a mix-in. This has been implemented in several large Python projects as well, but it just doesn’t make sense for Python, so it’s not used much.

There is a lot of built-in support in Python for functional programming in Lisp, such as Map, ZIP, filter, and of course lambda. Don’t talk about support, let’s talk about utility. Some in Pythoner avoid functional programming because it impairs code readability. So before you support something, think about whether it’s a good thing.

“The biggest drawback is that Ruby is powerful.” That’s disgusting. No comment.

Ruby doesn’t have internationalization support. What a joke. What did that Japanese think? Did he pass Cet-4?

As for Jython, there is jRuby now, probably because the author wrote it earlier. There are many different implementations of Python, such as Jython, IronPython, Pypy, Pyrex, etc. Python doesn’t have to be great in other languages to be great. Not to mention the hope that Java will come to ruby’s rescue. In addition, there are some disadvantages of Ruby that should not be avoided:

Ruby doesn’t have native threads, but instead uses pseudo-threads to take advantage of multicore cpus. CPython uses localized threads, but also cannot take advantage of multicore CPUS because it uses a GIL. But Stackless solves this problem, and Stackless elevates Python to parallel computing, where it competes with Erlang and Ruby doesn’t have to. The ultra-lightweight threading technology ensures that hundreds of thousands of threads can be easily run on a crappy machine. Twisted based asynchronous programming also offers an option.

When I first started learning Python, I heard that “Python is the slowest of the major dynamic languages”. Later, I learned that people who said that didn’t care about Ruby. If you add Ruby to the list of major dynamic languages, you have a language that is by many orders of magnitude slower than Python.

Is Ruby popular? Are you going to PHP? PHP is a great thing, but the problem is that it can only program for the WEB, which limits the scope of PHP applications. Ruby seems to be following this path right now. Until one day, someone revealed that “Ruby can do client programming”, which won everyone’s curiosity. And it is unclear what ROR can replace. People who have been rescued from Java WEB development have not all gone to Ruby.

Ruby or Python?

The design philosophies of Python and Ruby are quite different, and I’m not going to say which is better. In terms of efficiency, Ruby should never be compared to Python. Ruby is pseudo-threaded and there is no possibility of using a multi-core CPU. Pass directly. Python uses native

Thread, only because some modules are not Threadsafe, added a GIL to limit the use of multicore cpus, and in my recent tests, Twisted’s asynchronous threads were able to make good use of the computing power of multicore cpus. Execution efficiency is not an order of magnitude, try to know yourself.

Compare Java to Python and you can see how creative the author is. Open source projects are very Darwinian by natural selection. Is Ruby’s lack of open source projects an advantage? Also, I don’t see anything in Python except the WEB. What projects outside the framework have too much duplication. Pypcap, for example, has largely eliminated PCAPy.

Ruby has a long way to go when it comes to resources, so don’t be too juxtaposed when it comes to both sides. As for the Java community’s tendency to learn Ruby, I personally think it’s just the narrow-mindedness of java-obsessed developers. Language is a tool, object orientation is a tool, pure object orientation is not much better, Python also has support for functional programming, why did the author not mention. In addition, Python can support many practices that put development efficiency first rather than sticking to various forms of inheritance, even the multiple inheritance in C++ that is widely criticized by many people with limited intelligence. It’s not about supporting something you don’t like, it’s about getting as many people as possible to use what they like. Additionally, an example of Python not being OO enough, which has long been considered by Ruby developers, is the len(x) method used by Python to take the length of a sequence. If Ruby developers consider x.length to be OO, Python can use x.__len__() to get the length. From the Java perspective of encapsulating properties with methods, who is more OO? Haha.

Ruby is a Japanese work, ha ha, this is not to say, there are a lot of People do not like Japan, here I only in the technical level can put Ruby down, do not need to use non-technical things.

About Ruby on. Rails, the Ruby community really focused almost all of their efforts on that. But that only shows Ruby’s naivety, as it turns out, and many ROR imitators have come up with countless advanced features that far surpass ROR, not replacing it just out of preconceived notions. What if Today’s Ruby suddenly lost ROR? As for the zend mentioned by the author, compared with ROR, it is like a slap in the face. I have learned two WEB frameworks of Python and usually pay close attention to Python and Ruby, but I have never heard of zend, I wonder if it is the author’s work, haha. If you must have a fight on a WEB framework, you can use Django,Quixote,mod_python, etc. Django, a classic ROR parody, is still growing, but it already has a lot of features that are better than ROR, and far better performance than ROR, of course. Quixote’s Douban.com has the most traffic of any Python and Ruby WEB site, and is more than twice as fast as an ROR implementation on the same hardware configuration, which is an order of magnitude faster after all the equalization of losses on WEB servers and so on. As for mod_python, it is said that www.gnu.org uses this. If Ruby wants to open source, it can live in Python’s shadow forever.

As for the speed of the hand, each person has a different situation, no comment. As for what flexibility brings, that’s in the eye of the beholder. The author talks about how hard Python is to get started, and how easy Ruby is. When I first learned Python, I wrote a lexical parser in Python on day 11, which is still available on my blog. Therefore, the entry difficulty of this thing, everyone or to try it for themselves, do not have to listen to others.

There are a lot of things about ROR generated directories that take a long time to learn, and this is really a syndrome of ides. In Python, the typical example is TurboGears. If you want to understand how the entire application works, you can start with the core Cherrypy, and then there’s nothing you can’t learn from TurboGears. ROR has no choice at this Angle. Furthermore, scgi, one of the ways that ROR is now available to connect to WEB servers, was also a Python creation, another little thing that lived in Python’s shadow.

It’s hard to say what the future holds for Ruby, but since it’s a gamble, it’s a big risk. As for Python, I thought it was going to be smooth growth, but then Micro$oft came in and made it hard to predict how big Python’s future would be. Coming back to Python’s diversity, which the author has always hated, there are very few things that Ruby can do better than Python in my opinion, and the things that Python can do better than Ruby are certainly big gaps that Ruby cannot bridge. Therefore, considering the diversity of programming languages, it is not recommended to learn Ruby, there is one less choice, gather some popularity is always good.

Python or Ruby, which one do I choose?

Python is actually very close to Ruby, much closer than most other languages, so use whatever you like (honestly, though nonsense). There are a few differences in syntax, mostly syntax Sugar, and I’ll venture to list a few, but the main difference is in design: flexible vs. explicit. I don’t think there’s a difference in productivity, if you’re familiar with it. * Note that comparisons are only for the language itself.

  1. Ruby cases can match a lot of things: ranges/arrays, objects, regular expressions, and Python’s use of if/else instead of case/switch is a bit more rigid
  2. Python’s indentation is nice, although it can sometimes cause a bit of trouble. Ruby’s end is ugly, so everyone is forced to be one liner.
  3. Ruby feels a lot more OO than Python, although this may be because Python doesn’t encourage the illusion of ‘tricks’ that change the internal structure of objects
  4. Python has list comprehension, ruby does not 🙁
  5. Python has a real keyword argument, but Ruby hashes it, so it doesn’t really make a difference. Right
  6. Python self is annoying, ruby doesn’t have that kind of fussy stuff
  7. Reflection, Ruby has many built-in methods, such as Object.methods, and Python stores this information in special dictionaries. almost
  8. Ruby’s blocks are powerful, and Python’s lambda can only return a single value
  9. Ruby’s Open class has declared remote and can play with 2.days.ago tricks, and Python seems unable to modify the built-in classes directly and opposes doing so.
  10. Python requires @classMethod to decorate declared class methods; Ruby is built in
  11. Ruby has monad methods, which allow you to customize an object individually. Python doesn’t know of a similar concept
  12. Ruby has method_missing, and Python can intercept undefined methods using __getattr__.
  13. Ruby uses single inheritance + mixins, python uses multiple inheritance, but Python also has mixins
  14. Ruby has the attr_* series of syntax helpers, so instead of writing your own setters/getters, Python property methods still have to write their own setters/getters
  15. Both Ruby and Python use duck typing, but Python also has an explicit interface mechanism (was it incorporated into the kernel from Zope3?).
  16. Ruby’s function call parentheses are sparing and require a few less keystrokes. Python returns a reference to the function itself without parentheses and arguments by default.
  17. I don’t know how meta Programming python is, so I’ll have to wait and see. It’s just that pythoner doesn’t use that very often, and maybe it muddles the program logic.
  18. Ruby inherits some ugly things from Perl, such as a lot of predefined $x constants
  19. Ruby built – in regular expression, a little easier
  20. Ruby’s yield is used to call blocks. The Yield in Python is used to input and output values to the generator.
  21. Python’s libraries give me the impression that the naming conventions are a bit inconsistent, with some methods using snake_case and others using CamelCase, perhaps due to the legacy of too many libraries
  22. Python’s triple quotes are nice, Ruby’s << -xx… If XX is too ugly, you can use %q{… } Wrap multiple lines of text
  23. Ruby’s library design likes to alias methods for easy memorization.

Also: The Official Ruby website provides some basic comparisons.

Vi. Comparison of resources and learning curves of the two languages:

The overall impression, to use an unfortunate analogy, is that if Python is Java, Ruby is.NET. As we know, the Java world is very complex and diverse, and there are many open source projects with different ideas and performance characteristics for any given requirement. It is always difficult to choose which one to choose. The same is true for Python today, and because Python is far less difficult to develop than Java, there are many more Python projects than Java.

Both communities are strong in terms of resources, and interestingly, the Java community is now in danger of being assimilated by Ruby, at least in the few Javablog aggregations I subscribed to there is more Ruby talk than Java. Ruby’s community is more centralized, Python’s more fragmented. I always suspected that Ruby had more Japanese users, but it was hard to be sure because I didn’t know Japanese. With a founder whose first language is not English, I’m always a little scared that it’s going to be hard to understand, hard to keep up with the latest news, etc. That’s not necessarily a worry right now, but who knows!

Ruby’s sudden popularity is due to the Rails architecture. When you think about Ruby, think about Ruby on Rails. Rails provides a great framework for web development that is very efficient. There are many implementations of similar architectures in Python, but there is no one-size-fits all architecture. Python’s Zend, while complete, is more web server oriented and cannot be compared to Rails.

Ruby is easier to learn than Pyton. Ruby has a lot of interesting things to do in terms of language features, such as blocks, but the sheer scale of the fun stuff gets messy. Python syntax emphasizes simplicity, but it’s so flexible, so simple, that traditional programmers often find surprising expressions. I don’t know if this is a strength or a weakness, but AT the very least I think syntax is too flexible and tends to cause code styles to vary too much from programmer to programmer, increasing the cost of learning.

Ruby is easier to get started with, but once you reach a certain level of complexity, it gets harder all of a sudden. Python is not easy to get started with, nor is it too painful to be complex. Rails has problems that are easy to get started with but hard to get into. What does Rails generate directories for? How is O/R Mapping implemented? How to transfer data from the Web to the database. These are all problems that Ruby programmers face sooner or later. Python doesn’t work that way, and if you can’t figure that out, you probably can’t even get started. Whether it is VB, Delphi, or.net, how many developers who have used the project directory for less than half a year can explain the purpose of all the files under the project directory, and the syntax in each file? I believe that many experienced users may not say clearly.

Architecturally, the two are actually very different, but the end result is very similar. Ruby is a pure OO language, while Python is a mixture of functions and OO. Although Ruby can also code in a functional style, it is actually simulated. This difference doesn’t matter much to the average programmer, after all, it looks similar.

In general, Ruby is appropriate if non-professionals are trying it out for the first time. For professional programmers, I still recommend Python.

For the future, I think Python is going to be fairly stable and predictable. Python has become a community, not an individual, but Ruby, for a variety of reasons, is still influenced by the will of Maze, the author of Ruby. Sun controls Java, but Java is doing well because of Sun’s resources and JCP coordination, but it will take time to tell if Ruby can do the same.

From Python to Ruby

Python is an excellent language, and when you migrate from Python to Ruby, you’ll notice some syntactic differences.

The similarities

As with Python, in Ruby… There is an interactive hint (called irB). You can read documents from the command line (via ri instead of PyDoc). There are no special end-of-line symbols (except new lines). Text can be multiple lines, like three quotation marks in Python. [] is used for List and {} is used for Dict (” hashes “in Ruby).Arrays work the same way (two Arrays add together to make a longer Array, but a3 = [a1, a2] is merged). Will produce an array containing an array.Objects have fixed types and dynamic conversions. Everything is object, and the variable name is just a pointer to object. Although the keywords are different, exceptions work the same way. You have a tool for embedding documents (called Rdoc in Ruby).

The difference between

Unlike Python, in Ruby… Strings can change. You can use constants (the values of constants vary). There are some mandatory writing requirements (e.g., class names start with a capital letter, variable names start with a lowercase letter). There is only one type of container (Array), and it can be changed. Strings in quotes are restricted differently. There is no new style Class, there is only one style Class. You can’t access properties directly; in Ruby, it’s all done through method calls. Using () in method calls is an optional strategy. Instead of name hiding in Python, use private and other key words that restrict access. “Mixin’s” is used instead of multiple inheritance. You can modify existing classes and add new methods at any time. Use true and false instead of true and false (nil instead of None). Only false and nil are considered false when judging true values. All others are considered true (including 0, 0.0, “”, and []). Replace elsif with elif. Replace import with require. But the usage is the same. Comment the document with usual style (instead of docstrings) and use it to generate the document.

Compare Python and Ruby in three ways:

What applications are each suitable for

Development environment, operating environment

How about portability, as the project eventually plans to port to mobile platforms such as Windows CE Symbina

[1. Applicable application occasions]

The results of the review seem to be good for both languages, with good performance for web development. Both are ideal for rapid application development, which is highly efficient.

Python:

A description of some of the application aspects related to the project is extracted

Cross-platform development:

Python supports a different set of platforms in a neutral way, and it is best to develop applications in Python if the user is using a system that includes different platforms. Its adaptability also leaves the system open to the possibility of using other tools. Python is an ideal choice for frequent platform changers.

Python is also an alternative when providing software services to end users to avoid the time and expense of programming in different applications at the same time.

Internet Programming:

Python comes with standard modules that can communicate with network slots at both the elementary and protocol levels. For example, if you want to read E-mail from a POP server, Python comes with a library module that can do that. In addition, Python supports XML, HTML, and CGI library files, so it can be used to parse user input requirements and produce the best quality results from a web server.

Programmers can also compile modules for Apache, Unix, and Windows web servers that have a built-in Python interpreter. Based on the power of CGI programs, Python statements can be easily executed without being loaded separately.

There is a great book for network programming in Python called Fundamentals of Network Programming in Python.

This book provides a comprehensive introduction to the basics of network programming using Python, The main contents include basic network knowledge, advanced network operation and Web Services, parsing HTML and XHTML, XML, E-mail Services, FTP, using Python to manipulate databases, SSL, several server-side frameworks (including Socket server, SimpleXMLRPCServer, CGI, and mod_python), And multitasking (including Forking, threading, and asynchronous communication). With 175 examples and more than 6,600 lines of code, this practical book is a best practice for helping readers learn the Python language thoroughly and quickly and write web programs.

Ruby:

Ruby is a powerful, object-oriented scripting language that allows you to do object-oriented programming quickly and easily. Sometimes it’s a bit of a “fussiness” to develop small projects in a formal object-oriented language like Smalltalk, Eiffel, or C++. Of course, you can also use Ruby for normal procedural programming.

Ruby supports many network protocols, both high level and low level. Ruby provides basic classes that allow you to interact with TCP,UDP,SOCKS, and many other protocols without being stuck at the network layer. These classes also provide helper classes that allow you to easily read and write to the server. Network programming is also great.

[2. Development environment and operation Environment]

Python: By contrast, there is no strong integrated development environment. Some say open source software is easier to use than those that charge for it.

The ones that are used more:

Idle comes with Python: Not the best Python IDE…

PythonWin: Very comfortable to use (as comfortable as Windows). It has a nice editor that includes code merging, syntax tag highlighting, and code completion features. PythonWin, like some ides, does not include any type of form designer; But it provides an excellent debugger with monitoring, code inspection, interactive debugging Windows, breakpoints, and other debugger features. Most importantly, PythonWin is stable, although sometimes used on Win95r2 systems it can be strangely “stop-responsive.” In terms of interface, PythonWin is relatively simple, but very attractive, and makes good use of embeddable and interchangeable elements (I’m a bit partial to the Idle style of “many Windows Everywhere,” which is also used by many other ides). PythonWin also integrates the ActiveState HtmlHelp version of the Python documentation with PythonCOM.

Pydev eclipse+ Pydev

Pydev is a great Python environment based on Eclipse that can improve very quickly. Some of the features provided

UliPad:

An editor, you can use it for your document writing, programming development. It is developed in the Python programming language with a user interface based on wxPython. In addition to completing the common functions of general editors, it mainly wants to achieve a convenient and flexible framework, so that developers can easily develop new functions. Moreover, users with programming experience can also prepare plug-ins for special problems in daily work, so that they can be closely combined with their daily work. Using a powerful programming language like Python, you can easily modify the software to suit your needs.

UliPad supports code coloring, intelligent completion, code debugging, Python class browsing, code snippets, Ftp, directory browsing, and other powerful functions. Its Doc directory is very rich in documents. It is the best helper for you to write Python!

System requirements:

  • Python 2.4 +
  • WxPython 2.6 +

We ended up with UliPad, which was great.

Ruby:

Ruby has an excellent advanced debugger.

You can use netBeans’ Ruby plug-in or Eclipse’s Ruby plug-in

The general process of installing the development environment in Eclipse is as follows:

  • Install Ruby 1.8.6 one-click Installer.
  • Decompress the Eclipse Platform Runtime Binary package to a directory.
  • Unzip the contents of the Ruby Development Tools package into the appropriate Eclipse directory.

Operating environment download the corresponding version on its official website and then install, Windows installation is relatively simple, double click to install.

[3. Portability]

Python:

  1. Due to its open source nature, Python has been ported to many platforms (with modifications to make it work on different platforms). If you are careful to avoid using system-dependent features, all your Python programs can run on any of the following platforms without modification. These platforms include Linux, Windows, FreeBSD, Macintosh, Solaris, OS/2, Amiga, AROS, AS/400, BeOS, OS/390, Z /OS, Palm OS, QNX, VMS, Psion, Acom RISC OS, VxWorks, PlayStation, Sharp Zaurus, Windows CE and even PocketPC!
  2. When Python is executed, the source code in the.py file is first compiled into Python byte code(bytecode), which is then executed by the Python Virtual Machine. The basic idea of this mechanism is consistent with Java and.NET. However, Python Virtual Machine works with Java or. NET Virtual Machine is different, Python Virtual Machine is a more advanced Virtual Machine. Advanced here is not advanced in the usual sense, not that Virtual Machine Python is superior to Java or. NET is more powerful than Java or. NET, Python’s Virtual Machine is further removed from the real Machine. In other words, Python’s Virtual Machine is a Virtual Machine of a higher level of abstraction.
  3. Can install an object – oriented explanatory computer programming language, is also a powerful and perfect universal language, has more than ten years of development history, mature and stable. Python has the richest and most powerful class library of any scripting language, enough to support most everyday applications. The Symbina smartphone supports both C++ and JAVA applications, but with Python installed, it can support a wide variety of applications developed in Python. For the average mobile phone user, we don’t need to know too much, just install the Python platform, so that our mobile phone can support more programs developed in Python. At present, there are quite a few Python programs developed on Symbian mobile phones, which are also quite practical.

Ruby:

  1. It is mostly on Linux development, but can be in many types of Unix, Dos, Windows95/98 / Me/NT / 2000 / XP, MacOS, BeOS, OS / 2 system, etc.
  2. There is very little information on Ruby and mobile development. There is a version running on Windows CE, but there seems to be very little information on ruby now, and there are a lot of examples of failed installs and compilations. There is a small introduction in Japanese on the Japanese page.

【 summary 】

For Python and Ruby, I would like to give you some suggestions.

Python is also known as a clean language. Because its author designed it with the general guiding idea that there is only one best way to solve a particular problem. The Python language is an unambiguous language in the sense that its authors deliberately designed restrictive syntax so that bad programming habits (such as an if statement that does not indent the next line to the right) cannot be compiled. This intentionally forces programmers to develop good programming habits. Python also adheres to a clear and uniform style in other parts of its design, which has made Python a readable, maintainable, and versatile language popular with a large number of users.

Several people writing separately on the same problem in Python will look very similar. Ruby, on the other hand, has a different design philosophy and is so flexible that it can be written differently by different people.

Ruby English documentation is desperately lacking, let alone Chinese documentation. The Python community is relatively mature and has a wealth of resources.

Finally, a few Python sites are presented

  • www.python.org/ – Python’s official website
  • Python. cn/ – Python Chinese community
  • www.codeplex.com/Wiki/View.a… The web site

Several Ruby sites

  • www.ruby-lang.org/zh_CNRuby Chinese official website
  • www.rubystudy.com/bbs/tag.php… Chinese Learning exchange Community
  • Ruby -lang.guo.cc/Ruby online Reference Manual

【 Editor’s Recommendation 】

  1. Why Python is at the top of data science? Surveys show Python surpassing R
  2. Code gets sprayed again? 8 ways to make your code more Pythonic
  3. Python Web Frameworks: Django vs Flask vs Pyramid
  4. Python is the fastest growing major programming language
  5. Python vs Ruby: Who is the best Web development language?

Not li yan



Thumb up 0