View By

Categories

 

Interesting and Unknown facts about Python programming

Updated: Jul 29, 2019


Python has gained more popularity in past 1 year!


Actually, it’s the most popular programming language now. JAVA is the second most popular language after Python according to Google Trends.



Python is the most popular programming language in United States of America!



Do you know Monty Python?


Why Python is called Python? Absolutely nothing to do with the snakes! It was named after this comedy group called Monty Python. When Guido van Rossum began implementing Python, he was also reading the published scripts from “Monty Python’s Flying Circus”, a BBC comedy series from the 1970s. Van Rossum thought he needed a name that was short, unique, and slightly mysterious, so he decided to call the language Python.



The Python Logo - “Two Snakes”!


Projects and companies that use Python are encouraged to incorporate the Python logo on their websites, brochures, packaging, and elsewhere to indicate suitability for use with Python or implementation in Python. Use of the "two snakes" logo element alone, without the accompanying wordmark is permitted on the same terms as the combined logo.



According to Python Community,

"Python is powerful... and fast; plays well with others; runs everywhere; is friendly & easy to learn; is Open."


Import This!


There is actually a poem written by Tim Peters named as THE ZEN OF PYTHON which can be read by just writing import this.

import this  
#OutputThe 
Zen of Python, by Tim Peters 
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!


Wiki Python is best source of learning Python PythonBooks - Python Wiki.



Tuple Unpacking with Enumerate.


To get the index of elements. It is very useful for me when I look for indexes.

for a,b in enumerate([1,2,3,4,5]):    
    print a,
#Output 
0 1 
1 2
2 3
3 4
4 5


Chain comparison


For example, if you want to check if a number is between 1000 to 10000, you can code like this

if 1000<=num<=10000: 
    print True

You can work with infinity in Python

import math
math.isinf # Python 2
math.inf # Python 3

You can use else with for loop as well as while loop!



What about this unpacking?

x,y = 1,2
x,y = y,x+y
print x,
#Output
2 3


It’s over 38 years now


Van Rossum started developing the new script in the late 1980s and finally introduced the first version of that programming language in 1991. This initial release has module system of Modula-3. Later on, this programming language was named 'Python'.



Van Rossum answer to why was Python created in first place?


I had extensive experience with implementing an interpreted language in the ABC group at CWI, and from working with this group I had learned a lot about language design. This is the origin of many Python features, including the use of indentation for statement grouping and the inclusion of very-high-level data types (although the details are all different in Python).

I had a number of gripes about the ABC language, but also liked many of its features. It was impossible to extend the ABC language (or its implementation) to remedy my complaints – in fact its lack of extensibility was one of its biggest problems. I had some experience with using Modula-2+ and talked with the designers of Modula-3 and read the Modula-3 report. Modula-3 is the origin of the syntax and semantics used for exceptions, and some other Python features.

I was working in the Amoeba distributed operating system group at CWI. We needed a better way to do system administration than by writing either C programs or Bourne shell scripts, since Amoeba had its own system call interface which wasn’t easily accessible from the Bourne shell. My experience with error handling in Amoeba made me acutely aware of the importance of exceptions as a programming language feature.

It occurred to me that a scripting language with a syntax like ABC but with access to the Amoeba system calls would fill the need. I realized that it would be foolish to write an Amoeba-specific language, so I decided that I needed a language that was generally extensible.

During the 1989 Christmas holidays, I had a lot of time on my hand, so I decided to give it a try. During the next year, while still mostly working on it in my own time, Python was used in the Amoeba project with increasing success, and the feedback from colleagues made me add many early improvements.

In February 1991, after just over a year of development, I decided to post to USENET. The rest is in the Misc/HISTORY file.



Roundoff Error


0.1 + 0.2 - 0.3 is not equal to zero in Python (roundoff error)

0.1 + 0.2 - 0.3 
#output
5.551115123125783e-17


Packages


There are over 160K packages in PyPI repository



I think most of us are aware of this but still.. I love this one.


def superhero(x,y):    
    return x*y , x+y, x-y, x/y , x**
    mul, add, sub, div, power = superhero(7,2)
    print (mul, add, sub, div, power) 
#Output
(14, 9, 5, 3, 49)


Google


"Python has been an important part of Google since the beginning, and remains so as the system grows and evolves. Today dozens of Google engineers use Python, and we're looking for more people with skills in this language." said Peter Norvig, director of search quality at Google, Inc.


YouTube


"Python is fast enough for our site and allows us to produce maintainable features in record times, with a minimum of developers," said Cuong Do, Software Architect!!


Write your first blog & earn!!

Home   |   Contact Us

©2019 by Data Nebulae