Python 3 7 2

broken image


Release Date: April 9, 2012 Note: A newer bugfix release, 2.7.4, is currently available.Its use is recommended over previous versions of 2.7. Python 2.7.3 was released on April 9, 2012. 2.7.3 includes fixes for several reported security issues in 2.7.2: issue 13703 (oCERT-2011-003, hash collision denial of service), issue 14234 (CVE-2012-0876, hash table collisions CPU usage DoS.

Release Date: Dec. 24, 2018

After considering declining support for Python 2 programming language and added benefits from upgrades to Python 3, it is always advisable for a new developer to select Python version 3. However, if a job demands Python 2 capabilities, that would be an only compelling reason to use this version. A Python 2.7 and 3.4+ server implementation of the JSON RPC 2.0 protocol. / MIT: python-language-server: 0.35.1: An implementation of the Language Server Protocol for Python / MIT: python-leveldb: 0.20: Python bindings for leveldb database library / BSD 3-Clause: python-libarchive-c: 2.9: Python interface to libarchive / CC0-1.0: python. There are now newer bugfix releases of Python 3.7 that supersede 3.7.0 and Python 3.8 is now the latest feature release of Python 3. Get the latest releases of 3.7.x and 3.8.x here. We plan to continue to provide bugfix releases for 3.7.x until mid 2020 and security fixes until mid 2023. Among the major new features in Python 3.7 are.

Python 3.7.2 was the second bugfix release of Python 3.7.

There are now newer bugfix releases of Python 3.7 that supersede 3.7.2 and Python 3.8 is now the latest feature release of Python 3. Get the latest releases of 3.7.x and 3.8.x here. We plan to continue to provide bugfix releasesfor 3.7.x until mid 2020 and security fixes until mid 2023.

Among the major new features in Python 3.7 are:

  • PEP 539, new C API for thread-local storage
  • PEP 545, Python documentation translations
  • New documentation translations: Japanese,French, andKorean.
  • PEP 552, Deterministic pyc files
  • PEP 553, Built-in breakpoint()
  • PEP 557, Data Classes
  • PEP 560, Core support for typing module and generic types
  • PEP 562, Customization of access to module attributes
  • PEP 563, Postponed evaluation of annotations
  • PEP 564, Time functions with nanosecond resolution
  • PEP 565, Improved DeprecationWarning handling
  • PEP 567, Context Variables
  • Avoiding the use of ASCII as a default text encoding (PEP 538, legacy C locale coercionand PEP 540, forced UTF-8 runtime mode)
  • The insertion-order preservation nature of dict objects is now an official part of the Python language spec.
  • Notable performance improvements in many areas.

Please see What's New In Python 3.7 for more information.

  • PEP 537, 3.7 Release Schedule
  • Report bugs at https://bugs.python.org.
  • Help fund Python and its community.
  • The binaries for AMD64 will also work on processors that implement the Intel 64 architecture. (Also known as the 'x64' architecture, and formerly known as both 'EM64T' and 'x86-64'.)
  • There are now 'web-based' installers for Windows platforms; the installer will download the needed software components at installation time.
  • There are redistributable zip files containing the Windows builds, making it easy to redistribute Python as part of another software package. Please see the documentation regarding Embedded Distribution for more information.
  • UPDATED 2019-01-09: An issue was discovered in the embeddable packages for Windows and updated download files have been provided for the Windows x86-64 embeddable zip file and the Windows x86 embeddable zip file and their GPG signatures. No other download was affected. See https://bugs.python.org/issue35596 for more information.
  • For Python 3.7 releases, we provide two binary installer options for download. The default variant is 64-bit-only and works on macOS 10.9 (Mavericks) and later systems. We also continue to provide a 64-bit/32-bit variant that works on all versions of macOS from 10.6 (Snow Leopard) on. Both variants now come with batteries-included versions oF Tcl/Tk 8.6 for users of IDLE and other tkinter-based GUI applications; third-party and system versions of Tcl/Tk are no longer used. Consider using the newer 10.9 64-bit-only installer variant, unless you are building Python applications that also need to work on older macOS systems.
  • Both python.org installer variants include private copies of OpenSSL 1.1.0. Please carefully read the Important Information displayed during installation for information about SSL/TLS certificate validation and the Install Certificates.command.
VersionOperating SystemDescriptionMD5 SumFile SizeGPG
Gzipped source tarballSource release02a75015f7cd845e27b85192bb0ca4cb22897802SIG
XZ compressed source tarballSource releasedf6ec36011808205beda239c72f947cb17042320SIG
macOS 64-bit/32-bit installerMac OS Xfor Mac OS X 10.6 and laterd8ff07973bc9c009de80c269fd7efcca34405674SIG
macOS 64-bit installerMac OS Xfor OS X 10.9 and later0fc95e9f6d6b4881f3b499da338a9a8027766090SIG
Windows help fileWindows941b7d6279c0d4060a927a65dcab88c48092167SIG
Windows x86-64 embeddable zip fileWindowsfor AMD64/EM64T/x64f81568590bef56e5997e63b434664d587025085SIG
Windows x86-64 executable installerWindowsfor AMD64/EM64T/x64ff258093f0b3953c886192dec9f5276326140976SIG
Windows x86-64 web-based installerWindowsfor AMD64/EM64T/x648de2335249d84fe1eeb61ec25858bd821362888SIG
Windows x86 embeddable zip fileWindows26881045297dc1883a1d61baffeecaf06533256SIG
Windows x86 executable installerWindows38156b62c0cbcb03bfddeb86e66c3a0f25365744SIG
Windows x86 web-based installerWindows1e6c626514b72e21008f8cd53f945f101324648SIG

2to3 is a Python program that reads Python 2.x source code and applies a seriesof fixers to transform it into valid Python 3.x code. The standard librarycontains a rich set of fixers that will handle almost all code. 2to3 supportinglibrary lib2to3 is, however, a flexible and generic library, so it ispossible to write your own fixers for 2to3.

Using 2to3¶

2to3 will usually be installed with the Python interpreter as a script. It isalso located in the Tools/scripts directory of the Python root.

2to3's basic arguments are a list of files or directories to transform. Thedirectories are recursively traversed for Python sources.

Here is a sample Python 2.x source file, example.py:

Python

It can be converted to Python 3.x code via 2to3 on the command line:

A diff against the original source file is printed. 2to3 can also write theneeded modifications right back to the source file. (A backup of the originalfile is made unless -n is also given.) Writing the changes back isenabled with the -w flag:

After transformation, example.py looks like this:

Comments and exact indentation are preserved throughout the translation process.

By default, 2to3 runs a set of predefined fixers. The-l flag lists all available fixers. An explicit set of fixers to runcan be given with -f. Likewise the -x explicitly disables afixer. The following example runs only the imports and has_key fixers:

This command runs every fixer except the apply fixer:

Some fixers are explicit, meaning they aren't run by default and must belisted on the command line to be run. Here, in addition to the default fixers,the idioms fixer is run:

Notice how passing all enables all default fixers.

Sometimes 2to3 will find a place in your source code that needs to be changed,but 2to3 cannot fix automatically. In this case, 2to3 will print a warningbeneath the diff for a file. You should address the warning in order to havecompliant 3.x code.

2to3 can also refactor doctests. To enable this mode, use the -dflag. Note that only doctests will be refactored. This also doesn't requirethe module to be valid Python. For example, doctest like examples in a reSTdocument could also be refactored with this option.

The -v option enables output of more information on the translationprocess.

Since some print statements can be parsed as function calls or statements, 2to3cannot always read files containing the print function. When 2to3 detects thepresence of the from__future__importprint_function compiler directive, itmodifies its internal grammar to interpret print() as a function. Thischange can also be enabled manually with the -p flag. Use-p to run fixers on code that already has had its print statementsconverted. Also -e can be used to make exec() a function.

The -o or --output-dir option allows specification of analternate directory for processed output files to be written to. The-n flag is required when using this as backup files do not make sensewhen not overwriting the input files.

New in version 3.2.3: The -o option was added.

The -W or --write-unchanged-files flag tells 2to3 to alwayswrite output files even if no changes were required to the file. This is mostuseful with -o so that an entire Python source tree is copied withtranslation from one directory to another.This option implies the -w flag as it would not make sense otherwise.

The --add-suffix option specifies a string to append to all outputfilenames. The -n flag is required when specifying this as backupsare not necessary when writing to different filenames. Example:

Will cause a converted file named example.py3 to be written.

New in version 3.2.3: The --add-suffix option was added.

To translate an entire project from one directory tree to another use:

Fixers¶

Each step of transforming code is encapsulated in a fixer. The command 2to3-l lists them. As documented above, each can be turned onand off individually. They are described here in more detail.

apply

Removes usage of apply(). For example apply(function,*args,**kwargs) is converted to function(*args,**kwargs).

asserts

Replaces deprecated unittest method names with the correct ones.

From

To

failUnlessEqual(a,b)

Reinstall logic pro 9. assertEquals(a,b)

failIfEqual(a,b)

assertNotEquals(a,b)

failUnless(a)

assert_(a)

failIf(a)

failUnlessRaises(exc,cal)

failUnlessAlmostEqual(a,b)

assertAlmostEquals(a,b)

failIfAlmostEqual(a,b)

assertNotAlmostEquals(a,b)

basestring

Converts basestring to str.

buffer

Converts buffer to memoryview. This fixer is optionalbecause the memoryview API is similar but not exactly the same asthat of buffer.

dict

Fixes dictionary iteration methods. dict.iteritems() is converted todict.items(), dict.iterkeys() to dict.keys(), anddict.itervalues() to dict.values(). Similarly,dict.viewitems(), dict.viewkeys() and dict.viewvalues() areconverted respectively to dict.items(), dict.keys() anddict.values(). It also wraps existing usages of dict.items(),dict.keys(), and dict.values() in a call to list.

except

Converts exceptX,T to exceptXasT.

exec

Converts the exec statement to the exec() function.

execfile

Removes usage of execfile(). The argument to execfile() iswrapped in calls to open(), compile(), and exec().

exitfunc

Changes assignment of sys.exitfunc to use of the atexitmodule.

filter

Wraps filter() usage in a list call.

funcattrs

Fixes function attributes that have been renamed. For example,my_function.func_closure is converted to my_function.__closure__.

future

Removes from__future__importnew_feature statements.

getcwdu

Renames os.getcwdu() to os.getcwd().

has_key

Changes dict.has_key(key) to keyindict.

idioms

This optional fixer performs several transformations that make Python codemore idiomatic. Type comparisons like type(x)isSomeClass andtype(x)SomeClass are converted to isinstance(x,SomeClass).while1 becomes whileTrue. This fixer also tries to make use ofsorted() in appropriate places. For example, this block

is changed to

import

Detects sibling imports and converts them to relative imports.

imports

Handles module renames in the standard library.

imports2

Handles other modules renames in the standard library. It is separate fromthe imports fixer only because of technical limitations.

input

Converts input(prompt) to eval(input(prompt)).

intern

Converts intern() to sys.intern().

isinstance

Fixes duplicate types in the second argument of isinstance(). Forexample, isinstance(x,(int,int)) is converted to isinstance(x,int) and isinstance(x,(int,float,int)) is converted toisinstance(x,(int,float)).

itertools_imports

Removes imports of itertools.ifilter(), itertools.izip(), anditertools.imap(). Imports of itertools.ifilterfalse() are alsochanged to itertools.filterfalse().

itertools

Changes usage of itertools.ifilter(), itertools.izip(), anditertools.imap() to their built-in equivalents.itertools.ifilterfalse() is changed to itertools.filterfalse().

long

Renames long to int.

map

Wraps map() in a list call. It also changes map(None,x)to list(x). Using fromfuture_builtinsimportmap disables thisfixer.

metaclass

Converts the old metaclass syntax (__metaclass__=Meta in the classbody) to the new (classX(metaclass=Meta)).

methodattrs

See Full List On Chocolatey.org

Fixes old method attribute names. For example, meth.im_func is convertedto meth.__func__.

ne

Converts the old not-equal syntax, <>, to !=.

Get Python 3.7 - Microsoft Store

next

Converts the use of iterator's next() methods to thenext() function. It also renames next() methods to__next__().

Python 3.7.2 64 Bit

nonzero

Renames __nonzero__() to __bool__().

numliterals

Converts octal literals into the new syntax.

operator

Converts calls to various functions in the operator module to other,but equivalent, function calls. When needed, the appropriate importstatements are added, e.g. importcollections.abc. The following mappingare made:

From

To

operator.isCallable(obj)

callable(obj)

operator.sequenceIncludes(obj)

operator.contains(obj)

operator.isSequenceType(obj)

isinstance(obj,collections.abc.Sequence)

operator.isMappingType(obj)

isinstance(obj,collections.abc.Mapping)

operator.isNumberType(obj)

isinstance(obj,numbers.Number)

operator.repeat(obj,n)

operator.mul(obj,n)

operator.irepeat(obj,n)

operator.imul(obj,n)

paren

Add extra parenthesis where they are required in list comprehensions. Forexample, [xforxin1,2] becomes [xforxin(1,2)].

print

Converts the print statement to the print() function.

raise

Converts raiseE,V to raiseE(V), and raiseE,V,T to raiseE(V).with_traceback(T). If E is a tuple, the translation will beincorrect because substituting tuples for exceptions has been removed in 3.0.

raw_input

Converts raw_input() to input().

reduce

Handles the move of reduce() to functools.reduce().

reload

Converts reload() to importlib.reload().

renames

Changes sys.maxint to sys.maxsize.

repr

Welcome To Python.org

Replaces backtick repr with the repr() function.

set_literal

Replaces use of the set constructor with set literals. This fixeris optional.

standarderror

Renames StandardError to Exception.

sys_exc

Changes the deprecated sys.exc_value, sys.exc_type,sys.exc_traceback to use sys.exc_info().

throw

Fixes the API change in generator's throw() method.

tuple_params

Removes implicit tuple parameter unpacking. This fixer inserts temporaryvariables.

types

Fixes code broken from the removal of some members in the typesmodule.

unicode

Renames unicode to str.

urllib

Handles the rename of urllib and urllib2 to the urllibpackage.

ws_comma

Removes excess whitespace from comma separated items. This fixer isoptional.

xrange

Renames xrange() to range() and wraps existing range()calls with list.

xreadlines

Changes forxinfile.xreadlines() to forxinfile.

zip

Wraps zip() usage in a list call. This is disabled whenfromfuture_builtinsimportzip appears.

lib2to3 - 2to3's library¶

Source code:Lib/lib2to3/

Deprecated since version 3.10: Python 3.9 will switch to a PEG parser (see PEP 617), and Python 3.10 mayinclude new language syntax that is not parsable by lib2to3's LL(1) parser.The lib2to3 module may be removed from the standard library in a futurePython version. Consider third-party alternatives such as LibCST orparso.

Note

The lib2to3 API should be considered unstable and may changedrastically in the future.





broken image