Skip to Content
『Learning Python 第6版』
book

『Learning Python 第6版』

by Mark Lutz
March 2025
Intermediate to advanced
1172 pages
24h 57m
Japanese
O'Reilly Media, Inc.
Content preview from 『Learning Python 第6版』

第41章. すべての良きもの

この作品はAIを使って翻訳されている。ご意見、ご感想をお待ちしている:translation-feedback@oreilly.com

本書の最後へようこそ!さて、ここまで来たのだから、この章では最後にPythonの進化について少し述べてから、あなたをソフトウェアのフィールドに解き放ち、そしてちょっとした楽しみで締めくくる。

Pythonの全機能に触れることができたが、その中には専門家でなくても使えるスクリプト言語とは相反するような高度な機能も含まれている。多くのユーザはこれを現状として受け入れるのは理解できるだろうが、オープンソースプロジェクトでは、「なぜ」という質問をすることも重要だ。結局のところ、Pythonストーリーの軌跡とその真の結末は、少なくとも部分的にはあなた次第なのだ。

その目的のために、この章はPythonの最大の欠点の1つである変化の速さについて呼びかけることから始める。このトピックは主観的なものであることは避けられない。

Pythonの津波

12年前、本書はPythonが複雑になりすぎて肥大化していると警告した。明らかに、このメッセージは複雑化と肥大化の背後にいる人たちには届いていない。

それでも、これは重要なことなのだ。序文の言葉を借りれば、ここ十数年の間に、f文字列、名前付け代入文式、match 文、型ヒンティング、非同期コルーチン、辞書結合、スターアンパッキングの普及、アンダースコア桁区切り、モジュール属性フック、例外グループ、辞書キーの挿入順序、位置のみの関数引数、ハッシュベースのバイトコードファイル、 スナッブ、その他余計なものが増えてきた、モジュール属性フック、例外グループ、辞書キーの挿入順序、位置のみの関数引数、ハッシュベースのバイトコードファイル、sys.executable スナッブ、その他、余計な追加、意見の分かれる非推奨、そして途中で出会ったもつれた変異などがある。

その中には、奇妙に人工的なMROや、驚くほど暗黙的なsuper 、メタクラスや記述子を前提条件に昇格させる前章の恐ろしく複雑な継承アルゴリズムなどが含まれる。これらの合計は難解な泥沼であり、Pythonにおける名前の基本的な意味を難解にしている。

これらの変更について言うべきことのほとんどは、すでに本書で述べられているが、それらの重みを合わせると、他よりもシンプルであることを宣伝するツールとしては、問題であると言える。表41-1は、Pythonのこれまでのほとんど歯止めのない成長を、部分的ではあるが代表的な集計として、前版の記述を更新したものである。

表41-1. Pythonにおける冗長性とツールの爆発例
カテゴリー メンバー
3大パラダイム 手続き型、関数型、オブジェクト指向
4 文字列形式ツール % expression, , , f文字列str.format string.Template
4 属性アクセサー・ツール プロパティ、ディスクリプタ、__getattr__ 、__getattribute__
2 最終決定文 try/finally,with plus コンテキストマネージャー
4種類の理解力 リスト、セット、辞書、ジェネレーター
3つのクラス編成オプション 手動のリバインディング、@ デコレーター、メタクラス
4種類のメソッド インスタンス、スタティック、クラス、メタクラス
2 属性保存システム __dict__,__slots__
4種類の輸入品 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Fluent Python 第2版 ―Pythonicな思考とコーディング手法

Fluent Python 第2版 ―Pythonicな思考とコーディング手法

Luciano Ramalho, 牧野 聡
Fluent Python ―Pythonicな思考とコーディング手法

Fluent Python ―Pythonicな思考とコーディング手法

Luciano Ramalho, 豊沢 聡, 桑井 博之, 梶原 玲子

Publisher Resources

ISBN: 9798341634367