コンテンツにスキップ

Python

出典: フリー百科事典『ウィキペディア(Wikipedia)』
Python
Python
Pythonのロゴ
パラダイム 関数型プログラミングオブジェクト指向プログラミング動的計画法命令型プログラミング、マルチパラダイムプログラミング ウィキデータを編集
登場時期 1991年 (1991)
開発者 Pythonソフトウェア財団グイド・ヴァンロッサム ウィキデータを編集
最新リリース 3.12.2 - 2024年2月7日 (4か月前) (2024-02-07)[1] [±]
型付け 強い型付け 動的型付け
主な処理系 CPython, PyPy, IronPython, Jython
方言 Cython, RPython, Stackless Python
影響を受けた言語 ALGOL 68、ABCModula-3C言語C++PerlJavaLISPHaskellAPLCLUDylanIconStandard ML ウィキデータを編集
影響を与えた言語 Boo
Cobra
D
F#
Falcon
Go
Groovy
JavaScript[2]
Ruby[3]
Perl
Scala
Swift
プラットフォーム クロスプラットフォーム ウィキデータを編集
ライセンス Python Software Foundation License ウィキデータを編集
ウェブサイト www.python.org ウィキデータを編集
テンプレートを表示

Python

[]


Python1991

Python()使

PythonPython[ 1]

PythonOS [ 2] CPython PythonPythonCPython

[]


Python:








[]


PythonPython[ 3]

[]


Python使[ 4]

Python[ 3]: Perl[4]

Python

[]




 (: factorial)C

Python:
def factorial(x):
    if x == 0:
        return 1
    else:
        return x * factorial(x - 1)

わかりやすく整形されたC言語のコード:

int factorial(int x) {
    if (x == 0) {
        return 1;
    } else {
        return x * factorial(x - 1);
    }
}

この例では、Pythonと整形されたC言語とでは、プログラムコードの間に違いがほとんど見られない。しかし、C言語のインデントは構文規則上のルールではなく、単なる読みやすさを向上させるコーディングスタイルでしかない。そのためC言語では全く同じプログラムを以下のように書くこともできる。

わかりにくいC:

int factorial(int x) {
 if(x == 0) {return 1;} else
 {return x * factorial(x - 1); } }

Pythonではインデントは構文規則として決められているため、こうした書き方は不可能である。Pythonではこのように強制することによって、ソースコードのスタイルがその書き手にかかわらずほぼ統一したものになり、その結果読みやすくなるという考え方が取り入れられている。これについては賛否両論があり、批判的立場の人々からは、これはプログラマがスタイルを選ぶ自由を制限するものだ、という意見も出されている。

インデントによる整形は、単に「見かけ」だけではなく品質そのものにも関係する[5]。例として次のコードを示す。

間違えたC:

if (x > 10)
    x = 10;
    y = 0;

Cifif("y = 0;"if"{}""y = 0;"if)Apple goto fail



Python[5]

[]


Python





2Python使使2

Python

Python

[]


Python[6]


def greeting(name: str) -> str:
    return f"Hello {name}"

メモリ管理[編集]


PythonCPythonCPythonJythonIronPythonJythonIronPython

[]


Python使使Python

[]


Python PythonJava

 (inheritance) override; 

publicvirtualprivate2mangle; arithmetic operator使

[]


Python ("Battery Included")使



OS

XML



HTTP, FTP

CSV

 (SQLite)

GUI (Tkinter)

HTML

Python

: Python#

[]


Pythonbuilt-in types
Mapping[]

Mapping[7] dict  collections.abc.Mapping  __getitem__, __iter__, __len__ __getitem__ collection

[]


Python1() Python 2.0Unicode[ 5]

Python 3.0Python 2.xUnicodePython 3.0

PythonUnicodeUnicode

Python (EUC-JP, Shift_JIS, MS932, ISO-2022-JP) Python 2.4[ 6]GUITkinterIDLE

ASCIIPython使Python 3.xUTF-8[ 7]Python 3[ 8][ 9]Python 2.xASCII使12[ 10]EmacsVim Emacs 
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
s = '日本語の文字列'

実行環境[編集]


Python

[]


PythonAmoeba

Windows, Windows CE9xNTWindows 3.1MS-DOS

Macintosh (Classic Mac OSmacOS)

iOS Pythonista for iOS (omz:software)

Android Pydroid3 for Android (IIEC)

UNIX

Linux (Linux Standard Base3.2)

Plan 9 (Python 3.x)

PalmOS

S60

Java (Jython)

.NET Framework (IronPython)

[]


Python

CPython - CPythonCPython

Stackless Python - C使Python

Unladen Swallow - GooglePython

Jython - JavaPythonJava使

IronPython - .NET Framework/MonoPythonC#.NET Framework使.NET

PyPy - Python (RPython) Python

Psyco - CPythonJIT

Cython - PythonC

PyMite - AVR

tinypy - 64kB

MicroPython - 256 kB

Pyodide - WebAssembly[ 1]

IPython - Python

Codon - Python[8][9][10]

PyOMP - PythonOpenMP[11][12]

[]


Python

[]

/wheel/

PythonpippipenvpoetryryeEasyInstallwheel[ 11]

Python Package Index (PyPI) 

Anaconda (Python)

[]


Python

利用[編集]


Python使使AppleGoogle, Yahoo!, YouTube [ 12]S60Python[13]NASA[ 12][14]Python使

WebGUICAD3D

[]


NumPy, SciPyNumPy, SciPyC[15]Numba 使Python  LLVM  JITTensorFlow  GPU 

JetBrains Python調201710Python27%18%9%[16]

Web[]


Django  Flask WebWeb使JetBrains Python調20171026%Web[16]

[]


kivyandroidiOS

tkinterpythonGUI

PyQt

xPythonGUI

[]


PerlOS Python 

JetBrains Python調2017109%DevOps, , [16]

[]


Python[17]PythonABC[18]

Python--  Guido van Rossum 

 (IPA) 2020 COBOL  Python [19]

Python使[20]

PythonCPython

Python1[21]
# Pythonで記述した「Hello,World!」の例
# Pythonはたった一行のコードで文字を表示することができる。
print("Hello, World!")
// Javaで記述した「Hello, World!」の例
// Javaでは文字の表示に最低5行(括弧を除くと3行)コードを記述する必要がある(もちろん改行をせずに横に連ねて書けば1行にもできるのだが)。
public class hoge {
    public static void main(String...args) {
        System.out.println("Hello, World!");
    }
}

Python [21]

[21]

[]


Python使()使使[22]

Python使調使Wins Over ReplaceWAR使[23][24]

Python使使使使NBANHL使[?][23][24]

Python使調[23][24]Python調Python使調[25]

Python Scikit-learnsklearn使SVMNHLMLB調Apple WatchIMU使LPMLPM使EPL3NHLNBAMLBEPL使NHLNBAMLB[26]

[]


Amoeba使ABC[27]

0.9x[]


1991Python 0.90Modula-3

1.x[]


19941Python 1.0mapreduce

1.4Common Lisp

2.x[]


2000UnicodeHaskell

2.4subprocess[28]

2.62.x3.x2to3 lib2to3 [ 13]2.72.x2.7202011[ 14] 2.7.18 20204 2.7.x [29][30][ 15]
バージョン リリース日[31] サポート期限[32]
2.0 2000年10月16日
2.1 2001年4月15日
2.2 2001年12月21日
2.3 2003年7月29日
2.4 2004年11月30日
2.5 2006年9月19日
2.6 2008年10月1日 2013年10月29日
2.7 2010年7月4日 2020年1月1日

3.x[編集]


2008Python 3.0 西3000PythonPython 3000Py3K

2.x2.x3.xDjango3.x20163.x[33][]JetBrains Python調Python 23Python 3 2016140%20171075%[16][34]

201511Fedora 23[35]20164Ubuntu 16.04 LTS[36]Python2.x3.xRed Hat Enterprise Linux7.5Python 2deprecated[37]
バージョン リリース日[31] サポート期限[32]
3.0 2008年12月3日 2009年1月13日
3.1 2009年6月27日 2012年4月9日
3.2 2011年2月20日 2016年2月20日
3.3 2012年9月29日 2017年9月29日
3.4 2014年3月16日 2019年3月18日
3.5 2015年9月13日 2020年9月30日
3.6 2016年12月23日 2021年12月
3.7 2018年6月27日 2023年6月
3.8 2019年10月14日 2024年10月
3.9 2020年10月5日 2025年10月
3.10 2021年10月4日 2026年10月
3.11 2022年10月24日 2027年10月
3.12 2023年10月2日 2028年10月

3.0[38]

printprint

Unicode

int

3.1[39][40]



unittest

TkinterTile

importPythonimportlib

with

3.2[41]

 stable ABI

pyc 

E-mail  SSL 

pdb (Python debugger) 

3.3

3.12[42]

yield from

uUUnicode

UCS-4

Pythonvirtualenvvenv

3.4[43][44]

pathlib

enum

statistics

Pythontracemalloc

I/Oasyncio

Python

3.5[45][46]

zip

byte/bytearray%

@

os.scandir()





.pyo



3.6[47]

Formatted string literals

Syntax for variable annotations

asyncawait (async/await)Asynchronous generators

secrets

DTraceSystemTap

3.7[48][ 16]

使使

C UTF-8 

breakpoint() 

dict 

 (10-9s) 





3.8[ 17]

 :=



f f'{expr=}' 

pickle 5

dict  reversed 

3.9[49]



removeprefix(),removesuffix()

Generic

zoneinfo

3.10[50]






 X | Y 

: TypeAlias 



zip

3.11[51]

3.12[52]

Python []


1990 - Stichting Mathematisch Centrum (CWI)Python

1995 - Corporation for National Research Initiatives (CNRI) Python

20003 - Python BeOpen.com BeOpen PythonLabs 10PythonLabsDigital Creations (Zope Corporation) 

2001 - PythonPython (PSF) Zope CorporationPSF

Python[]


ABC

Modula-2, -3

Icon

SETL

C, C++

Smalltalk

Lisp, Scheme

[]


Python PSF (Python Software Foundation) GPLGPL

注釈[編集]

出典[編集]



(一)^ Python Release Python 3.12.2.  Python.org (202427). 2024211

(二)^ Chapter 3. The Nature of JavaScript - Speaking JavaScript2019419

(三)^ Bini, Ola (2007). Practical JRuby on Rails Web 2.0 Projects: bringing Ruby on Rails to the Java platform. Berkeley: APress. p. 3. ISBN 978-1-59059-881-8 

(四)^ TIMTOWTDIthere's more than one way to do it

(五)^ abDesign and History FAQ  Python 3.9.6 documentation. docs.python.org. 2021826

(六)^ typing ---   Python 3.10.0b2 

(七)^ "A mapping object maps hashable values to arbitrary objects." The Python Standard Library - Python ver3.11.2. 2023-03-01.

(八)^ exaloop/Codon

(九)^ "Python-based compiler achieves orders-of-magnitude speedups", MIT News, (March 14, 2023).

(十)^ "MIT Turbocharges Pythons Notoriously Slow Compiler > Codon lets users run Python code as efficiently as C or C++", IEEE Spectrum (2023330)

(11)^ T. G. Mattson, T. A. Anderson and G. Georgakoudis, "PyOMP: Multithreaded Parallel Programming in Python," in Computing in Science & Engineering, vol. 23, no. 6, pp. 77-80, 1 Nov.-Dec. 2021, doi: 10.1109/MCSE.2021.3128806.

(12)^ PyOMP: Parallel multithreading that is fast AND Pythonic. Presented by Tim Mattson (Intel)

(13)^ Python for S60. 2007117

(14)^ KEKB: An Asymmetric Electron-Positron Collider for B-Factory in KEK. 2007117

(15)^ Python for Scientists and Engineers. 201589

(16)^ abcdPython Developers Survey 2017 - Results

(17)^ TSpython 

(18)^ EDU-SIG: Python in Education. 2011516

(19)^  IPA  

(20)^  3 (20195)

(21)^ abcPython. www.hallo.jp. 202362

(22)^ Foundations of Sports Analytics: Data, Representation, and Models in Sports. Coursera. 202222

(23)^ abcMoneyball and Beyond. Coursera. 202222

(24)^ abcPrediction Models with Sports Data. Coursera. 202222

(25)^ Wearable Technologies and Sports Analytics. Coursera. 202222

(26)^ Introduction to Machine Learning in Sports Analytics. Coursera. 202222

(27)^ Why was Python created in the first place?. General Python FAQ.  Python Software Foundation. 2007322

(28)^ https://www.fenet.jp/dotnet/column/language/7841/ Pythonsubprocess使.NET Column (2021325) 2023517

(29)^ "Python 2.7.18Python 2.7Python 2 "

(30)^ Peterson, Benjamin (2020420). Python Insider: Python 2.7.18, the last release of Python 2. Python Insider. 2020427

(31)^ abPython Documentation by Version.  Python Software Foundation. 2014320

(32)^ ab17. Development Cycle  Python Developer's Guide

(33)^ . Python23.   . 2016921

(34)^ By the numbers: Python community trends in 2017/2018 | Opensource.com

(35)^ Changes/Python 3 as Default.  Fedora Project. 2016921

(36)^ kuromabo. Ja.  Ubuntu.com. 2016921

(37)^ Red Hat Enterprise Linux 7 Chapter 53. Deprecated Functionality - Red Hat Customer Portal

(38)^ ! Python 3.0 - 2.   (200911). 2014313

(39)^ Python 3.1.  OSDN Corporation (200971). 2014313

(40)^ Python 3.1.  OSDN Corporation (2009630). 2014313

(41)^ Python 3.2.  OSDN Corporation (2011222). 2014313

(42)^  (2012101). Python 3.3.  SourceForge.JP. 2014313

(43)^  (2014318). Python 3.4.  . 2014320

(44)^  (2014318). Python 3.4.  SourceForge.JP. 2014320

(45)^  (2015913). Python 3.5.0.  . 2015115

(46)^ Python 3.5  .   (2015914). 2015115

(47)^  (20161226). Python 3.6.  OSDN. 2017526

(48)^  (2018629). Python 3.7.  OSDN. 2018711

(49)^ What's New In Python 3.9  Python 3.9.12 

(50)^ What's New In Python 3.10  Python 3.10.4 

(51)^ What's New In Python 3.11. Python documentation. 2024423

(52)^ What's New In Python 3.12. Python documentation. 2024423

一次文献[編集]



(一)^ Welcome to Python.org (). Python.org. 2020810

(二)^ History and License. 2016125 "All Python releases are Open Source"

(三)^ abPeters, Tim (2004819). PEP 20  The Zen of Python. Python Enhancement Proposals.  Python Software Foundation. 20081124

(四)^ About Python.  Python Software Foundation. 2012424, second section "Fans of Python use the phrase "batteries included" to describe the standard library, which covers everything from asynchronous processing to zip files."

(五)^ Lemburg, Marc-André (2000310). PEP 100 -- Python Unicode Integration. Python Enhancement Proposals.  Python Software Foundation. 2014212

(六)^ Whats New in Python 2.4

(七)^ PEP 3120 -- Using UTF-8 as the default source encoding | Python.org

(八)^ PEP 538 -- Coercing the legacy C locale to a UTF-8 based locale | Python.org

(九)^ PEP 540 -- Add a new UTF-8 Mode | Python.org

(十)^ PEP 0263 -- Defining Python Source Code Encodings. Python Enhancement Proposals.  Python Software Foundation (200166). 2014212

(11)^ "Wheel attempts to remedy these problems by providing a simpler interface between the build system and the installer." PEP 427 -- The Wheel Binary Package Format 1.0

(12)^ abQuotes about Python. 2007115

(13)^ Python 2  Python 3 .  Python Software Foundation. 2014313

(14)^ PEP 373 -- Python 2.7 Release Schedule | Python.org

(15)^ Sunsetting Python 2 (). Python.org. 2019922

(16)^ What's New In Python 3.7  Python 3.7.5 

(17)^ What's New In Python 3.8  Python 3.8.0 

関連項目[編集]


IPython - Python

MyHDL - Python

Julia () - PythonCFortranPython





 - Python[1][2]

[]


Quentin Charatan, Aaron Kans: Programming in Two Semesters: Using Python and Java, Springer, (2022).

John Hunt: A Beginners Guide to Python 3 Programming, Springer, (2023).

John Hunt: Advanced Guide to Python 3 Programming, Springer, (2023).

PythonISBN 978-48731168842014918

PythonISBN 978-4-339-02498-220151013

Python [] ISBN 978-4-87783-837-92018510

Python [] SBISBN 978-4-7973-9544-02018522

PythonSB ISBN 978-481560152220195302

1PythonISBN 978-4-295-00853-82020311

PythonISBN 978-4-7981-6364-22020622

Guido van RossumPython 4ISBN 978-4-87311-935-92021127

Bill Lubanovic Python 3 2ISBN 978-4-87311-932-82021322

Python [] SBISBN 978-4-8156-0764-72021122

PythonISBN 978-4-7649-0633-42021731

Python 2ISBN 978-4-7981-6936-120211117

:Python ABC!ISBN 978-47649064262022916

 Python  Lv.1ISBN 978-4-407-35255-920221026

Python ISBN 978-4-407-35591-820221125

Patrick ViaforePython ISBN 978-4-8144-0017-1 (2023325)

Micha GorelickIan OzsvaldPython 2ISBN 978-4873119908 (2023414)

Michal Jaworski and Tarek ZiadePython 4KADOKAWAISBN 978-4-048931113 (2023721)

Wes McKinneyPython 3ISBN 978-4814400195 (2023812)

Python 2SB ISBN 978-48156178372023829

David M. Beazley駿Python Distilled - PythonISBN 978-4-8144-0046-120231014

Christian Hill:Python2ISBN 978-4-807920570 (20231120) 

PCIT PythonISBN 978-4798066868202431

PythonISBN 978-47649069692024528

Tiago Rodrigues AntãoPythonISBN 9784798183732 (2024624) 

[]

  1. ^ Why is it called Python? - Python Software Foundation
  2. ^ Glyn Moody 小山祐司監訳『ソースコードの反逆』株式会社アスキー、2002年6月11日、384頁。 

外部リンク[編集]


Welcome to Python.org - Python 

Python 

Python Japan - 

Python awesome

Allen B. Downey():Think Python: "Think Python: How to Think Like a Computer Scientist", Creative CommonPDF

How to Think Like a Computer Scientist: Interactive Edition

Wes, Mckinney: "Python for Data Analysis, 3E" (Open Edition, HTML).

Python (2018813).

 Python 201920202CRID 1510292572199325696hdl:2433/245698CC-BY-NC-ND https://creativecommons.org/licenses/by-nc-nd/4.0/deed.ja  
  Python (2023CC-BY-NC-ND )



Python - 

Python - Python Japan

1.  Python 

Python  2020421

 IPSJ MOOC # 
 Python

 Python使

Python使

Python((C) 2014-2022 , 2022109)

Python©20202023,   (CC BY-NC-ND 4.0)

Python -