2014-06-27 0:16 GMT+10:00 Samuel David <samuel.co...@eos-hoepers.com>: > Mas estou com uma dúvida referente ao tópico “Por que eu deveria usar Python > e não <insira aqui a sua linguagem favorita>?”.
Google Translate tells me you're asking "Why use Python instead of <some other language>?". (I'm going to respond only in English, as my Portuguese is basically nil. Sorry.) Well, there are a lot of reasons :) One is that Python is a clear and simple language; a form of "executable pseudo-code". If you start by writing what you want to do as comments, then translate slightly into a more formal grammar to make pseudo-code, you're pretty close to having stubby Python code. There's a minimum of fuss, the language does its best to get out of the way and let you do your work. Closely related to that is Python's excellent interactive mode. Since you don't have to declare variables or anything, you can simply fire up Python interactively (eg by just typing "python", or with something like IDLE), and it is simultaneously a clean environment in which you just say "a = 2+3" and assign 5 to a, and a full programming environment that gives you all the power you need (for instance, you can define functions, then call them - that's something I was never able to do in REXX, at least not without some fiddling). In contrast, a language like Pike is that bit more wordy at its interactive prompt, as you need to make appropriate declarations. And any language that doesn't have first-class functions is going to be much less clean for this sort of work - REXX doesn't have any concept of run-time function creation at all, except that it can (ab)use the file system for that job. Another advantage of Python is Unicode support. Particularly if you're using Python 3.3 or newer, you're guaranteed that a string consists of a sequence of Unicode codepoints, and you can depend on being able to index and slice it accordingly. This is way WAY better than C, or PHP, or any other language that sticks its head in the sand and tries to ignore character encodings altogether; and it's better than UTF-16 languages like JavaScript, because you avoid the subtle errors that can creep in when you index a string with astral characters. You can happily write your program and test it on Portuguese text, and be confident that it'll work just as well with Hebrew. Finally, Python is a well-established language. You can write an application in Python and simply tell people "You'll need a Python interpreter, version 3.3 or better, to run this", and be confident that they'll be able to get one - most Linux distros include Python in their repositories, a Mac probably has it installed, on Windows it's just a matter of fetching the .msi, and there are unofficial builds for obscure platforms like OS/2. (Which I make good use of, incidentally. We have a legacy OS/2 system, now running as a virtual machine under Linux, on which we run certain legacy software. How do we back up the crucial data from there? Simple: A Python script that archives the necessaries, sends them via TCP/IP, and reports its status to the user. I think it took me all of half a screenful of code to write that.) There are other languages that I use and love, too; each one has its strengths and weaknesses. These are just a few of Python's strengths. ChrisA -- https://mail.python.org/mailman/listinfo/python-list