Sponsored Links

Jumat, 17 November 2017

Sponsored Links

CPython internals - Generators - Lecture 9 - YouTube
src: i.ytimg.com

CPython is the reference implementation of the Python programming language. Written in C, CPython is the default and most widely used implementation of the language.

CPython is an interpreter. It has a foreign function interface with several languages including C, in which one must explicitly write bindings in a language other than Python.


Video CPython



Design

A significant limitation of CPython is the use of a global interpreter lock (GIL) on each CPython interpreter process, which effectively disables concurrent Python threads within one process. Concurrency can only be achieved with separate CPython interpreter processes managed by a multitasking operating system. This complicates communication between concurrent Python processes, though the multiprocessing module mitigates this somewhat. Much discussion took place on whether to remove the GIL from CPython. A set of "free threading" patches to CPython was submitted by Greg Stein, which effectively replaced GIL with fine-grained locking. However the patches were rejected due to the execution overhead they introduced into single-process code.


Maps CPython



Distribution

Supported platforms include:

Unix-like
  • AIX
  • BSD
  • Darwin
  • FreeBSD
  • HP-UX
  • illumos
  • IRIX 5 and later (unsupported in 3.x)
  • Plan 9
  • macOS (OS X)
  • NetBSD
  • Linux
  • OpenBSD
  • Solaris
  • Tru64
Special and embedded
  • GP2X
  • iPodLinux
  • Nintendo DS
  • Nintendo Gamecube
  • Symbian OS Series60
  • Nokia 770 Internet Tablet
  • Nokia N800
  • Nokia N810
  • Nokia N900
  • Palm OS
  • PlayStation 2
  • PlayStation 3 (FreeBSD)
  • Psion
  • QNX
  • Sharp Zaurus
  • Xbox/XBMC
  • VxWorks
  • Openmoko
  • Apple iOS
  • Android
  • BlackBerry 10
Other
  • AROS
  • VMS (unsupported since 3.3)
  • OS/2 (unsupported since 3.3)
  • OS/390
  • RISC OS (unsupported since 3.0)
  • Windows XP and later
  • Windows 2000 (unsupported since 3.3)
  • z/OS

PEP 11 lists platforms which are not supported in CPython by Python Software Foundation. These platforms can still be supported by external ports. These ports include:

  • AtheOS (unsupported since 2.6)
  • BeOS (unsupported since 2.6)
  • DOS (unsupported since 2.0)
  • IRIX 4 (unsupported since 2.3)
  • Mac OS 9 (unsupported since 2.4)
  • MINIX (unsupported since 2.3)
  • Windows 3.x (unsupported since 2.0)
  • Windows 9x (unsupported since 2.6)
  • Windows NT4 (unsupported since 2.6)

External ports not integrated to Python Software Foundation's official version of CPython, with links to its main development site, often include additional modules for platform-specific functionalities, like graphics and sound API for PSP and SMS and camera API for S60. These ports include:

  • Amiga: AmigaPython
  • AS/400: iSeriesPython
  • DOS using DJGPP: PythonD
  • PlayStation Portable: Stackless Python for PSP
  • Symbian OS: Python for S60
  • Windows CE/Pocket PC: Python Windows CE port

Enterprise Linux

These Python versions are distributed with currently-supported enterprise Linux distributions.


cpython - Twitter Search
src: pbs.twimg.com


History

Version history

Unladen Swallow

Unladen Swallow was an optimization branch of CPython, intended to be fully compatible and significantly faster. It aimed to achieve its goals by supplementing CPython's custom virtual machine with a just-in-time compiler built using LLVM.

The project had stated a goal of a speed improvement by a factor of five over CPython; this goal was not met.

The project was sponsored by Google, and the project owners, Thomas Wouters, Jeffrey Yasskin, and Collin Winter, are full-time Google employees, however most project contributors are not Google employees. Unladen Swallow is hosted on Google Code.

Like many things regarding the Python language, the name Unladen Swallow is a Monty Python reference, specifically to the joke about the airspeed velocity of unladen swallows in Monty Python and the Holy Grail.

Although it fell short of all published goals, Unladen Swallow did produce some code which got added to the main Python implementation, such as improvements to the cPickle module.

In July 2010, some observers speculated on whether the project was dead or dying, since the 2009 Q4 milestone had not yet been released. The traffic on Unladen's mailing list had decreased from 500 messages in January 2010, to fewer than 10 in September 2010. It has also been reported that Unladen lost Google's funding. In November 2010, one of the main developers announced that "Jeffrey and I have been pulled on to other projects of higher importance to Google".

The 2009 Q4 development branch was created on January 26, 2010, but no advertising was made on the website. Further, regarding the long-term plans, and as the project missed the Python 2.7 release, a Python Enhancement Proposal (PEP) was accepted, which proposed a merge of Unladen Swallow into a special py3k-jit branch of Python's official repository. As of July 2010, this work was ongoing. This merging would have taken some time, since Unladen Swallow was originally based on Python 2.6 with which Python 3 broke compatibility (see Python 3000 for more details). However, the PEP was subsequently withdrawn.

In early 2011, it became clear that the project was stopped.

  • 2009 Q1
  • 2009 Q2
  • 2009 Q3 and beyond: reduce memory use, improve speed

Ziua Comunicatiilor 2016: Benchmark CPython vs PyPy - YouTube
src: i.ytimg.com


Alternatives

CPython is one of several "production-quality" Python implementations including: Jython, written in Java for the Java virtual machine (JVM), PyPy, written in RPython and translated into C, and IronPython, which is written in C# for the Common Language Infrastructure. There are also several experimental implementations.


CPython on topsy.one
src: pbs.twimg.com


References


Frankie Dintino - 2 + 2 = 5: Monkey-patching CPython with ctypes ...
src: i.ytimg.com


External links

  • CPython at Google Code

Source of the article : Wikipedia

Comments
0 Comments