Recently we in edition earned the well-known 80/20 rule: 80% of the time employees perform their duties, and the remaining 20% do third-party things associated with the site. So, our editor Gregory Prophets have prepared the sixth edition of the podcast that keeps getting better. Now I’m going to constantly talk about his hobby — programming — and why today to be able to program isn’t just for programmers.
A lot about that programming languages be the same as what was foreign languages in the 1990s and 2000s years: to become a class expert, you need to know at least the basics. To be honest: the professionals with whom I spoke, this is not always agree. But they agree that programming develops thinking and logic, not to mention the fact that it’s just a very interesting exercise.
Start with the background
Not counting school and University both business BASIC and Pascal, from which, in my opinion, more harm than good, I have a basic knowledge of the three languages: C, Objective-C and Swift. I can write them a simple little apps for myself — and I’m working on in my spare time. A couple of weeks ago, I decided that the ecosystem of XCode I was boring, and I wanted to try something else.
To start working with python easier
It is sufficient to download the package on the official website, run command line, type “python3” and you are ready.
From pure python syntax
It was one of the goals of the Creator of the language Guido van Rossum. Unlike C-like languages, code blocks in Python are not braces, and the space or tab preceded by a colon. This not only simplifies code, but also forces the programmer to organize it properly — otherwise the work would be impossible. And that’s not to mention the fact that in Python you do not need to end each line with a semicolon, and, for example, to declare a method easily, in contrast to the same Objective-C — those who did, I understand. In theory Python can read, even people not familiar with programming.
Python supports multiple programming paradigms
Learning Python, you will lay in your mind the basics that can then be used in other languages: basic data types, conditional statements and loop statements, classes, functions and methods, exception handling, and more.
Plenty of functions and libraries facilitating work — from the generation of random numbers from the random libraries to the built-in function enumerate () which simplifies the code in the loops does not need to create a variable with the number of passed cycles.
Active community developing language
Everything that happens to him is regulated by the PEP — Python Enhancement Proposal (“proposal to improve Python”). After a thorough discussion in the documentation add a new PEP, which standardizer language and impose rules of etiquette. Due to this, Python is constantly updated and keeps up with the times — although it is almost 25 years old.
Surely there are other benefits — for example, a well-known web frameworks like Django and Flask, but they haven’t worked.
The fact that the work of any editor full routine of actions, repeated day in and day. In programming there are usually DRY — Don’t Repeat Yourself (“not repeated”). Its essence is that if the code is repeated at least once a piece, the piece needs to turn into a function. If good programmers follow this rule, then all the editors whom I know, violating it. Routine that is easy to automate, is a luxury in 2015. So in this blog every time I’ll give yourself small tasks that will help to facilitate the work of our editors, and you will watch how I do them. So I want to show that programming will be useful to all and in everything it is no longer rocket science, as some believe.
But the misconceptions related to programming, maybe next time. But in the meantime give yourself a task for the next issue of the blog. The first thing I want to do is the script which prepared the text to be edited. I’m going with time to improve, but I’ll start with one simple thing that will show the power and beauty of Python. Many editions have “the black list” with words that they never use — have it. The problem is that from time to time to seek out these words in the texts annoying, especially when dealing with new authors (or old when persistently continue to use these words). For the next release I’ll write a simple script that will highlight forbidden words in the text caps lock on, so they will be easier to find and remove.
According to tradition two trivial lines of code:
best_website = “My Site”