Moment For Technology

An advanced guide to Python from Facebook

Posted on Aug. 26, 2023, 5:23 a.m. by Michele Brock
Category: The back-end Tag: The back-end

A few days ago, the PYPL (Or Programming Language Popularity Index, based on the frequency of Google searches) released its list of programming languages for May, and Python took the NO.1 spot as the most popular. The TIOBE chart also shows that Python has hit new highs in popularity and is currently number four and growing at a high rate.

No wonder, as a necessary language in the era of big data and artificial intelligence, Python has many advantages. It has a simple language, high development efficiency and strong portability. After years of ecological construction, Python has a large number of function libraries, especially in the field of data analysis and scientific computing. In addition, functions are first-class citizens in Python, so Python is also a functional programming language.

In order to be more competitive in the era of big data and AI, more and more programmers are learning Python as their first language. Many people find Python powerful and easy to learn, with a less steep learning curve and no effort at all. But if you open the door to Python, it's easy to get started but hard to master. Seems to remember the grammar thoroughly, but as soon as the actual project, was beaten back to the prototype.

Such as:

  • You're going to build an e-commerce backend that stores the ID, name, and price of every product. Now that we need to figure out the price based on the item ID, how do we use the most appropriate data structure?
  • Dictionaries and collections are highly optimized data structures in Python. What is the time complexity of using lists to store data and find it?
  • What about dictionaries? Which is more efficient? In fact, with 100,000 data stored in different data structures, the difference in search speed can vary by thousands of times.

Such as:

  • What is the difference between coroutines and threads in Python?
  • How do generators evolve into coroutines?
  • What is the relationship between future and Asyncio in concurrent programming?
  • How do you write thread-safe, high-performance code?

As far as I can tell, most beginners are probably stuck here. However, we have to say that solving these problems is a basic skill of a qualified Python engineer. In order to help users from a beginner to a good Python engineer, I have jointly launched a column called "Python Core Techniques and Practical" with geek Time, hoping to help you systematically improve your Python practical programming skills.

In this column, we will not dwell on some obscure knowledge. Instead, we will explain the core techniques and applications of Python from a practical point of view, using examples from our work as the main thread. Start with basic grammar, master advanced usage of the language, and then carry out practical development in the project. Let you connect the knowledge points learned through the project, integrate them, and form your own Python learning framework.

This entire column is based on the latest version of Python, version 3.7, and is a departure from many of the old learning materials on the web. Python 3 is undoubtedly the future of Python.

Who am I? What will it say?

I'm Jing Xiao, a senior engineer at Facebook. At present, I am engaged in machine learning related work, mainly in the field of artificial intelligence recommendation ranking system and algorithm. I have led the development and implementation of hundreds of millions of user-grade products, with rich engineering and practical experience. Prior to joining Facebook, I received my MASTER's and Bachelor's degrees in computer science from Columbia University and Communication Engineering from Wuhan University.

In Python Core Techniques and Combat, I'll take you through the Python core from beginning to end.


  1. Python Basics

Required knowledge: Basic Python data structures basic Python syntax file manipulation error and exception handling Python Object-oriented modularity

As a first step, you need to know the core basics of Python. Of course, different from other basic textbooks, I not only talk about basic concepts and operations, but also sort out a lot of advanced knowledge for you, as well as some important and difficult points and mistakes that need to be paid attention to. Not only can let the entry-level programmer to check the missing, salvage the foundation, but also can let the experienced programmer, from the engineering perspective to understand the foundation, sublimation understanding.

  1. Advanced Python core knowledge

Required knowledge: [Python protocol] [Advanced Python Syntax] [Python regular Expressions] [Python concurrent programming] [garbage collection mechanism] [Project Combat]

The second step is to get to the core of Python, such as decorators, concurrent programming, and so on. If your job is to write scripts that are less than 100 lines long, you probably won't be able to use them. But if you're doing large application development, it's absolutely necessary.

  1. Specification: Write high-quality Python programs

This section focuses on teaching you to write more formal, more stable programs. In my actual work, I have seen many programmers who can write programs, but the writing is really a bit "terrible to see", resulting in the final debugging of errors, modification is very expensive. Therefore, I think it is necessary to have a separate section on this issue.

Instead of specious specifications, I'll teach you how to improve your code with specific programming practices and techniques. For example, how to decompose code properly, use Assert, how to write unit tests, and so on.

  1. Build a quantitative trading system in Python


A man who has never been on the battlefield and shot cannot be a commander; A language learner without practical experience cannot become a master. In this part, I will take you through the practical case of quantitative trading system, and take you through the comprehensive application of Python.

To really master a programming language, it is not enough to only learn scattered knowledge points, but also to connect the knowledge points together and do some medium-sized projects to have a deeper understanding and improvement.

In addition, everything in this column is based on the latest Version of Python, version 3.7, and there are plenty of exclusive readings, case studies, and a lot of discoveries and experiences I've made reading the source code. At the same time, on the level of division, I hope to balance the difficult and easy, step by step, not only core basic knowledge, but also advanced operations, as far as possible "suitable for all ages".


Limited time subscription benefits

  1. With a limited time discount of ¥68, the price of 1 movie will take you to the core of Python technology.
  2. New users can also get a 5 yuan coupon.


Long press sweep code subscription column

About (Moment For Technology) is a global community with thousands techies from across the global hang out!Passionate technologists, be it gadget freaks, tech enthusiasts, coders, technopreneurs, or CIOs, you would find them all here.