Python
Python2 Source Code Study: Dictionary and List Implementation
· β˜• 5 min read
1. Why Dictionary Lookups Are Faster Than List Lookups First, take a look at the following piece of code. 1 2 3 4 5 6 7 8 9 10 11 12 13 from time import time t = time() data = [chr(i) for i in range(97, 123)] # data =

Python2 VS Python3
· β˜• 1 min read
1. Differences Between Python 2 and 3 Feature \ Version Python 2 Python 3 print as a function print"abc" print(“abc”) Unified class Old-style and new-style classes New-style classes only Floating-point division 1/2=0 1/2=0.5 String formatting %, Format Format,% xrange replaces range xrange range long renamed to int Long,int Int Package imports Relative imports Absolute imports Source file encoding Ascii utf8 The official Python recommendation is strongly in favor of learning Python 3 directly, since Python 2 is only maintained through 2020.

Python 2 Source Code Study: Windows Compilation
· β˜• 2 min read
1. Compiler Preparation Prepare the Python source code From the official Python website, download the source code for the Python version you need to compile. The one chosen here is the latest Python 2 release, Python-2.7.14.tar.xz, click here to go there. Prepare a compiler On Windows, the project files built

Python2 Source Code Study: pyc
· β˜• 8 min read
This article uses the Python 2.7.8 source code as an example. 1. Common File Formats in Python py file A Python source code file, which can be modified with a text editor. pyc file The bytecode file generated after Python source code is compiled. pyw file When a pyc file is executed, a console window appears; when a pyw file is executed, it does not.

How to Build a PyPI Server with devpi
· β˜• 5 min read
When you install Python packages with pip, it looks up the corresponding package on the https://pypi.python.org/simple/ index by default, then downloads and installs it. But in an intranet environment, or when you need to publish some private packages to designated users, you have to build your own PyPI Server. This post mainly records the process of building a PyPI Server index with the devpi tool, along with some commonly used commands.