Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 ALL


  C++ and Java over Python in Google products

In Google, most of the products are written in C++ and Java. They usually don't choose Python to write their product stack. What's behind the decision to choose one language over the other in Google? Let's get to read some opinions from Robert Love, a Google software engineer.Love said he couldn't imagine writing let alone maintaining a large software stack in Python. They use C++, Go, and Java for production software systems, with Python employed for scripting, testing, and tooling.There are a bunch of reasons for the primacy of C++ and Java:Familiarity. Early Googlers were well-versed in C++...

17,318 2       JAVA GOOGLE PYTHON


  Learning Python as your first programming language

Python is a widely used general-purpose, high-level programming language Its design philosophy emphasizes code readability, and its syntax allows programmers to express concepts in fewer lines of code than would be possible in languages such as C. Python now becomes more and more popular and is now being used the first teaching language in some universities. Why would you like to learn Python as your first programming language? Below are the reasons.Python is a high-level language with dynamic typing. It means it won't bother you with things like pointers and memory management, and provides yo...

12,277 0       ADVANTAGE PYTHON


  Python basics summary

Python is recommended by many people as the first language to be learned now. Even in some universities, it is the primary language to be taught to CS/CE students. To master this languages, we should understand some basics of it. Here we summarize some basics about this language.These basics include : string replacement with regular expression, traverse a directory, sort a list, remove duplication, dictionary ordering, dictionary, list, string conversion, date object manipulation, command line parameter parsing(getopt), formatted output, Call system commands or scripts with Python, Python file...

11,114 0       SUMMARY PYTHON


  The tic-tac-toe game with Python

In this tutorial, we will show how to build a tic-tac-toe game with Python. We will use functions,arrays,if statements,while statements, for loops and error handling etc.First, we need to create two functions, the first function will display the borad of the game:def print_board(): for i in range(0,3): for j in range(0,3): print map[2-i][j], if j != 2: print "|", print ""Here we used two for loops to loop through the map, this map is a two dimensional array which contains the location information.The board looks like: | | | | |...

24,932 1       PYTHON TIC-TAC-TOE


  A Python assignment trap

Python has no assignment, it only has reference. Assume, we have following code snippet:>>> values = [0, 1, 2]>>> values[1] = values>>> values[0, [...], 2]Why the result is not [0, [0, 1, 2], 2], instead it goes into an infinite loop? To understand this, we need to understand some basics about Python.Python has no variables, it only has labels. When we run:values = [0, 1, 2]Python will first create a list object [0,1,2], then it labels it as values. If we later run:values = [3, 4, 5]Python will then create a new list object [3,4,5] and it will tear off the values lab...

9,428 0       PYTHON TRAP ASSIGNMENT SHALLOW COPY


  Using Fabric to deploy web app

Many people may use FTP and rsync to synchronize codes to server, this way is fine but it may be troublesome when you need to deploy many times a day, actually there is a simple way if you can spend time on finding the fast way. We introduce Fabric today for deploying web app to remote server.Fabric is a deployment tool written with Python, the biggest feature if it is you no need to login to remote server, you can execute remote commands locally.Here is s simple deployment script written with Python : fabfile.py(Do not change the file name). Put it in your project directory.#!/usr/bin/env pyt...

6,732 0       PYTHON SSH FABRIC WEB DEPLOYMENT


  Build route graph of Hurricane Sandy

Hurricane Sandy swept US east side and landed in New York, it killed 113 persons and incurred 50 billion US dollars economic loss. Sandy is also considered as the most expensive hurricane. We will now use matplotlib and basemap libraries in Python to build a route graph of Sandy.Below is the animated GIF.Shadow is added in the graph to show the time at night, we can see from the graph that Sandy stayed a while in Panama after emerging, then it went through Cuba and became Hurricane-2. Later Sandy moved along US east coast and then turned to west suddenly, headed directly to New York and landed...

14,033 0       PYTHON HURRICANE SANDY ROUTE GRAPH


  Python object creation sequence

[The Python version described in this article is 3.x]This article aims to explore the process of creating new objects in Python. As I explained in a previous article, object creation is just a special case of calling a callable. Consider this Python code:class Joe: passj = Joe()What happens when j = Joe() is executed? Python sees it as a call to the callable Joe, and routes it to the internal function PyObject_Call, with Joe passed as the first argument. PyObject_Call looks at the type of its first argument to extract its tp_call attribute.Now, what is the type of Joe? Whenever we define a ...

2,288 0       PYTHON OBJECT CREATION