Metaprogramming with Python: A programmer's guide to writing reusable code to build smarter applications

Aloorravi, Sulekha

  • 出版商: Packt Publishing
  • 出版日期: 2022-09-09
  • 定價: $1,680
  • 售價: 9.0$1,512
  • 語言: 英文
  • 頁數: 402
  • 裝訂: Quality Paper - also called trade paper
  • ISBN: 1838554653
  • ISBN-13: 9781838554651
  • 相關分類: Python程式語言
  • 立即出貨 (庫存=1)

商品描述

A practical approach to metaprogramming with real-world examples that enables the development of advanced frameworks, libraries, and applications using Python

Key Features

- Learn applied metaprogramming through a simple step-by-step approach
- Work with easily understandable examples and explanations that take you deep into the theory of metaprogramming
- Get practical experience in writing reusable code with real-world examples

Book Description

Effective and reusable code makes your application development process seamless and easily maintainable. With Python, you will have access to advanced metaprogramming features that you can use to build high-performing applications.

The book starts by introducing you to the need and applications of metaprogramming, before navigating the fundamentals of object-oriented programming. Next, you will learn about simple decorators, work with metaclasses, and later focus on introspection and reflection. You'll also delve into generics and typing before defining templates for algorithms. As you progress, you will understand your code using abstract syntax trees and explore method resolution order. This Python book also shows you how to create your own dynamic objects before structuring the objects through design patterns. Finally, you will learn simple code-generation techniques along with discovering best practices and eventually building your own applications.

By the end of this learning journey, you'll have acquired the skills and confidence you need to design and build reusable high-performing applications that can solve real-world problems.

What you will learn

- Understand the programming paradigm of metaprogramming and its need
- Revisit the fundamentals of object-oriented programming
- Define decorators and work with metaclasses
- Employ introspection and reflection on your code
- Apply generics, typing, and templates to enhance your code
- Get to grips with the structure of your code through abstract syntax trees and the behavior through method resolution order
- Create dynamic objects and generate dynamic code
- Understand various design patterns and best practices

Who this book is for

If you are an intermediate-level Python programmer looking to enhance your coding skills by developing reusable and advanced frameworks, then this book is for you. Basic knowledge of Python programming will help you get the most out of this learning journey.

商品描述(中文翻譯)

一本實用的書籍,以真實世界的例子介紹元程式設計,讓讀者能夠使用Python開發高級框架、函式庫和應用程式。

主要特點:
- 透過簡單的逐步方法學習應用的元程式設計
- 使用易於理解的例子和解釋,深入探討元程式設計的理論
- 通過真實世界的例子獲得實際經驗,撰寫可重複使用的代碼

書籍描述:
有效且可重複使用的代碼可以使應用程式開發過程無縫且易於維護。使用Python,您將可以使用高級的元程式設計功能來構建高性能的應用程式。

本書首先介紹了元程式設計的需求和應用,然後深入探討了物件導向編程的基礎知識。接下來,您將學習簡單的裝飾器,使用元類,並專注於內省和反射。您還將深入研究泛型和類型提示,然後定義算法的模板。隨著學習的進展,您將使用抽象語法樹來理解代碼,並探索方法解析順序。本書還向您展示如何創建自己的動態物件,然後通過設計模式來結構化這些物件。最後,您將學習簡單的代碼生成技術,並發現最佳實踐,最終構建自己的應用程式。

通過這段學習之旅的結束,您將獲得設計和構建可重複使用的高性能應用程式所需的技能和信心,並能解決真實世界的問題。

您將學到什麼:
- 理解元程式設計的編程範式及其需求
- 重新學習物件導向編程的基礎知識
- 定義裝飾器並使用元類
- 在代碼中應用內省和反射
- 使用泛型、類型提示和模板來增強代碼
- 通過抽象語法樹理解代碼的結構,並通過方法解析順序了解其行為
- 創建動態物件並生成動態代碼
- 理解各種設計模式和最佳實踐

本書適合對Python有中級程度的編程人員,希望通過開發可重複使用和高級框架來提升編碼技能。具備Python編程的基礎知識將有助於您在這段學習之旅中獲得最大的收益。

作者簡介

Sulekha AloorRavi is an engineer and a data scientist with a wide technical breadth and deep understanding of many technologies and systems. Her background has led her to advanced Python based application development in the field of artificial intelligence. She enjoys solving real-world business problems with technology and working with data science and business intelligence teams to deliver real value.

She has 15+ years of experience in Software Engineering and worked with major IT solution providers and International Banks. She graduated with an engineering degree in Information Technology and later completed a post-graduation program in Big Data and Machine Learning. She also enjoys teaching Artificial Intelligence and Machine Learning.

作者簡介(中文翻譯)

Sulekha AloorRavi是一位工程師和數據科學家,具有廣泛的技術知識和對多種技術和系統的深入理解。她的背景使她在人工智能領域的高級Python應用程序開發方面有所建樹。她喜歡用技術解決現實世界的商業問題,並與數據科學和商業智能團隊合作,提供真正的價值。

她在軟件工程方面擁有15年以上的經驗,曾與主要的IT解決方案提供商和國際銀行合作。她畢業於信息技術工程學位,後來完成了大數據和機器學習的研究生課程。她還喜歡教授人工智能和機器學習。

目錄大綱

1. The Need For and Applications of Meta programming
2. Refresher of OOP Concepts in Python
3. Understanding Decorators and Their Applications
4. Working with Metaclasses
5. Understanding Introspection
6. Implementing Reflection on Python Objects
7. Understanding Generics and Typing
8. Defining Templates for Algorithms
9. Understanding Code through Abstract Syntax Tree
10. Understanding Method Resolution Order of Inheritance
11. Creating Dynamic Objects
12. Applying GOF Design Patterns – Part 1
13. Applying GOF Design Patterns – Part 2
14. Generating Code from AST
15. Implementing a Case Study
16. Following Best Practices

目錄大綱(中文翻譯)

1. 元編程的需求和應用
2. Python中面向對象編程概念的複習
3. 理解裝飾器及其應用
4. 使用元類進行工作
5. 理解內省
6. 在Python對象上實現反射
7. 理解泛型和類型提示
8. 定義算法的模板
9. 通過抽象語法樹理解代碼
10. 理解繼承中的方法解析順序
11. 創建動態對象
12. 應用GOF設計模式-第1部分
13. 應用GOF設計模式-第2部分
14. 從抽象語法樹生成代碼
15. 實施一個案例研究
16. 遵循最佳實踐