Commit Graph

80 Commits

Author SHA1 Message Date
Yury Selivanov 03660041d2 Issue #28091: Document PEP 525 & PEP 530.
Patch by Eric Appelt.
2016-12-15 17:36:05 -05:00
Eric Snow 4f29e75289 Issue #24254: Drop cls.__definition_order__. 2016-09-08 15:11:11 -07:00
Eric Snow b957b0c2bc Issue #28030: Update the language reference for PEP 468. 2016-09-08 13:59:58 -07:00
Eric Snow 92a6c170e6 Issue #24254: Preserve class attribute definition order. 2016-09-05 14:50:11 -07:00
Berker Peksag 91494d3b73 Issue #26576: Merge from 3.5 2016-08-03 10:17:51 +03:00
Berker Peksag 6cafececbf Issue #26576: Clarify that the @deco syntax is not always an equivalent of f = deco(f)
Patch by Chris Angelico.
2016-08-03 10:17:21 +03:00
Yury Selivanov 711d25db48 Merge 3.5 (issue #27243) 2016-06-09 15:13:16 -04:00
Yury Selivanov a6f6edbda8 Issue #27243: Fix __aiter__ protocol 2016-06-09 15:08:31 -04:00
Benjamin Peterson 815b61d4ce merge 3.5 (#27042) 2016-05-16 23:20:32 -07:00
Benjamin Peterson 54044d605f class definitions only get argument lists (closes #27042) 2016-05-16 23:20:22 -07:00
Benjamin Peterson bc7ee43a6d Backed out changeset 71ff2235bb4c (closes #27042) 2016-05-16 23:18:33 -07:00
Serhiy Storchaka 7b1e5a7722 Remove redundant leading zeroes in PEP references. 2016-03-31 15:31:20 +03:00
Serhiy Storchaka e4ba872543 Remove redundant leading zeroes in PEP references. 2016-03-31 15:30:54 +03:00
Robert Collins df395991f6 Issue #9232: Support trailing commas in function declarations.
For example, "def f(*, a = 3,): pass" is now legal.

Patch from Mark Dickinson.
2015-08-12 08:00:06 +12:00
Yury Selivanov 75b5ab5770 docs: Fix productionlist for async def functions 2015-08-01 16:19:36 -04:00
Yury Selivanov 8fb307cd65 Issue #24619: New approach for tokenizing async/await.
This commit fixes how one-line async-defs and defs are tracked
by tokenizer.  It allows to correctly parse invalid code such
as:

>>> async def f():
...     def g(): pass
...     async = 10

and valid code such as:

>>> async def f():
...     async def g(): pass
...     await z

As a consequence, is is now possible to have one-line
'async def foo(): await ..' functions:

>>> async def foo(): return await bar()
2015-07-22 13:33:45 +03:00
Yury Selivanov 66f8828bfc Issue #24439: Improve PEP 492 related docs.
Patch by Martin Panter.
2015-06-24 11:04:15 -04:00
Yury Selivanov 5376ba9630 Issue #24400: Introduce a distinct type for 'async def' coroutines.
Summary of changes:

1. Coroutines now have a distinct, separate from generators
   type at the C level: PyGen_Type, and a new typedef PyCoroObject.
   PyCoroObject shares the initial segment of struct layout with
   PyGenObject, making it possible to reuse existing generators
   machinery.  The new type is exposed as 'types.CoroutineType'.

   As a consequence of having a new type, CO_GENERATOR flag is
   no longer applied to coroutines.

2. Having a separate type for coroutines made it possible to add
   an __await__ method to the type.  Although it is not used by the
   interpreter (see details on that below), it makes coroutines
   naturally (without using __instancecheck__) conform to
   collections.abc.Coroutine and collections.abc.Awaitable ABCs.

   [The __instancecheck__ is still used for generator-based
   coroutines, as we don't want to add __await__ for generators.]

3. Add new opcode: GET_YIELD_FROM_ITER.  The opcode is needed to
   allow passing native coroutines to the YIELD_FROM opcode.

   Before this change, 'yield from o' expression was compiled to:

      (o)
      GET_ITER
      LOAD_CONST
      YIELD_FROM

   Now, we use GET_YIELD_FROM_ITER instead of GET_ITER.

   The reason for adding a new opcode is that GET_ITER is used
   in some contexts (such as 'for .. in' loops) where passing
   a coroutine object is invalid.

4. Add two new introspection functions to the inspec module:
   getcoroutinestate(c) and getcoroutinelocals(c).

5. inspect.iscoroutine(o) is updated to test if 'o' is a native
   coroutine object.  Before this commit it used abc.Coroutine,
   and it was requested to update inspect.isgenerator(o) to use
   abc.Generator; it was decided, however, that inspect functions
   should really be tailored for checking for native types.

6. sys.set_coroutine_wrapper(w) API is updated to work with only
   native coroutines.  Since types.coroutine decorator supports
   any type of callables now, it would be confusing that it does
   not work for all types of coroutines.

7. Exceptions logic in generators C implementation was updated
   to raise clearer messages for coroutines:

   Before: TypeError("generator raised StopIteration")
   After: TypeError("coroutine raised StopIteration")
2015-06-22 12:19:30 -04:00
Yury Selivanov f3e40fac10 Issue 24180: Documentation for PEP 492 changes. 2015-05-21 11:50:30 -04:00
Terry Jan Reedy 65e3ecb3e2 Issue #22243: fix except grammar in reference. 2014-08-23 19:29:47 -04:00
Zachary Ware 2f78b84c47 Issue #21439: Fix a couple of typos. 2014-06-03 09:32:40 -05:00
Raymond Hettinger aa7886dd3f Issue 21439: Minor issues in the reference manual.
(Contributed by Feliks Kluzniak.)
2014-05-26 22:20:37 -07:00
Zachary Ware 9fafc9f79a Add prompts to interactive example.
This makes it match the new example below, and allows Sphinx's
"hide the prompts and output" feature to work.
2014-05-06 09:18:17 -05:00
Zachary Ware 8edd532026 Issue #21366: Document the fact that ``return`` in a ``finally`` clause
overrides a ``return`` in the ``try`` suite.
2014-05-06 09:07:13 -05:00
Terry Jan Reedy 7c895edabc Closes 21048: Index 'as' in import and with statements. 2014-04-29 00:58:56 -04:00
Georg Brandl 6930777c63 merge with 3.3 2013-10-06 10:28:48 +02:00
Georg Brandl 242e6a0bce Use "lambda expression" as preferred to "lambda form". 2013-10-06 10:28:39 +02:00
Benjamin Peterson 1ef876cd28 evaluate positional defaults before keyword-only defaults (closes #16967) 2013-02-10 09:29:59 -05:00
Chris Jerdonek b43099464a Add additional links and index entries for "argument" and "parameter".
This adds to the work done for issue #15990 (i.e. f44b8d69e5fc and the
commits referenced there).
2012-12-25 14:54:44 -08:00
Chris Jerdonek c131b0760d Fix formatting of syntax description of function definition. 2012-10-25 17:21:22 -07:00
Mark Dickinson 05ee5817a1 Issue #14167: restore statement about breaks in finally clauses. 2012-09-24 20:16:38 +01:00
Andrew Svetlov f158d86074 Issue #14167: Document return statement in finally blocks.
Patch by Yury Selivanov.
2012-08-14 15:38:15 +03:00
Georg Brandl 64a40949cf Closes #14186: add link to PEP 3107 (function annotations) to the function definition section. 2012-03-10 09:22:47 +01:00
Benjamin Peterson d204934ee3 exception support is correct now (closes #13705) 2012-01-03 16:30:37 -06:00
Benjamin Peterson 57f97f400b parameter_list was meant here 2011-12-23 20:01:43 -06:00
Benjamin Peterson ad17358a2f kill superfluous 'comprehension' case (closes #13658) 2011-12-23 20:00:56 -06:00
Ezio Melotti e130a52d8a Remove duplication. 2011-10-19 10:58:56 +03:00
Ezio Melotti fc3db8a91e #11669: rephrase footnote in the Compound Statements page. 2011-06-26 11:25:28 +03:00
Ezio Melotti 147f6088f0 #11446: merge with 3.1. 2011-03-11 20:53:24 +02:00
Ezio Melotti 7885833df0 #11446: fix incorrect PEP link. 2011-03-11 20:50:42 +02:00
Georg Brandl 41d0815a65 Merged revisions 87789-87790 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k

........
  r87789 | georg.brandl | 2011-01-06 10:23:56 +0100 (Do, 06 Jan 2011) | 1 line

  Fix various issues (mostly Python 2 relics) found by Jacques Ducasse.
........
  r87790 | georg.brandl | 2011-01-06 10:25:27 +0100 (Do, 06 Jan 2011) | 1 line

  Add acks where acks are due.
........
2011-01-09 08:01:46 +00:00
Georg Brandl b30f3303f7 Fix various issues (mostly Python 2 relics) found by Jacques Ducasse. 2011-01-06 09:23:56 +00:00
Georg Brandl ab32fec83c Merged revisions 85572-85573,85606,85609-85622,85624,85626-85627,85629,85631,85633,85635-85636,85638-85639,85641-85642 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k

........
  r85572 | georg.brandl | 2010-10-16 20:51:05 +0200 (Sa, 16 Okt 2010) | 1 line

  #10122: typo fix.
........
  r85573 | georg.brandl | 2010-10-16 20:53:08 +0200 (Sa, 16 Okt 2010) | 1 line

  #10124: typo fix.
........
  r85606 | georg.brandl | 2010-10-17 08:32:59 +0200 (So, 17 Okt 2010) | 1 line

  #10058: tweak wording about exception returns.
........
  r85609 | georg.brandl | 2010-10-17 11:19:03 +0200 (So, 17 Okt 2010) | 1 line

  #8556: use less confusing mapping key in example.
........
  r85610 | georg.brandl | 2010-10-17 11:23:05 +0200 (So, 17 Okt 2010) | 1 line

  #8686: remove potentially confusing wording that does not add any value.
........
  r85611 | georg.brandl | 2010-10-17 11:33:24 +0200 (So, 17 Okt 2010) | 1 line

  #8811: small fixes to sqlite3 docs.
........
  r85612 | georg.brandl | 2010-10-17 11:37:54 +0200 (So, 17 Okt 2010) | 1 line

  #8855: add shelve security warning.
........
  r85613 | georg.brandl | 2010-10-17 11:43:35 +0200 (So, 17 Okt 2010) | 1 line

  Fix hmac docs: it takes and returns bytes, except for hexdigest().
........
  r85614 | georg.brandl | 2010-10-17 11:46:11 +0200 (So, 17 Okt 2010) | 1 line

  #8968: add actual name of token constants.
........
  r85615 | georg.brandl | 2010-10-17 12:05:13 +0200 (So, 17 Okt 2010) | 1 line

  #459007: merge info from PC/getpathp.c and using/windows.rst to document the forming of sys.path under Windows.
........
  r85616 | georg.brandl | 2010-10-17 12:07:29 +0200 (So, 17 Okt 2010) | 1 line

  Fix copy-paste error in example.
........
  r85617 | georg.brandl | 2010-10-17 12:09:06 +0200 (So, 17 Okt 2010) | 1 line

  #5212: md5 weaknesses do not affect hmac, so remove the note about that.
........
  r85618 | georg.brandl | 2010-10-17 12:14:38 +0200 (So, 17 Okt 2010) | 1 line

  #9086: correct wrong terminology about linking with pythonXY.dll.
........
  r85619 | georg.brandl | 2010-10-17 12:15:50 +0200 (So, 17 Okt 2010) | 1 line

  Make file names consistent.
........
  r85620 | georg.brandl | 2010-10-17 12:22:28 +0200 (So, 17 Okt 2010) | 1 line

  Remove second parser module example; it referred to non-readily-available example files, and this kind of discovery is much better done with the AST nowadays anyway.
........
  r85621 | georg.brandl | 2010-10-17 12:24:54 +0200 (So, 17 Okt 2010) | 1 line

  #9105: move pickle warning to a bit more prominent location.
........
  r85622 | georg.brandl | 2010-10-17 12:28:04 +0200 (So, 17 Okt 2010) | 1 line

  #9112: document error() and exit() methods of ArgumentParser.
........
  r85624 | georg.brandl | 2010-10-17 12:34:28 +0200 (So, 17 Okt 2010) | 1 line

  Some markup and style fixes in argparse docs.
........
  r85626 | georg.brandl | 2010-10-17 12:38:20 +0200 (So, 17 Okt 2010) | 1 line

  #9117: fix syntax for class definition.
........
  r85627 | georg.brandl | 2010-10-17 12:44:11 +0200 (So, 17 Okt 2010) | 1 line

  #9138: reword introduction to classes in Python.
........
  r85629 | georg.brandl | 2010-10-17 12:51:45 +0200 (So, 17 Okt 2010) | 1 line

  #5962: clarify sys.exit() vs. threads.
........
  r85631 | georg.brandl | 2010-10-17 12:53:54 +0200 (So, 17 Okt 2010) | 1 line

  Fix capitalization.
........
  r85633 | georg.brandl | 2010-10-17 12:59:41 +0200 (So, 17 Okt 2010) | 1 line

  #9204: remove mentions of removed types in the types module.
........
  r85635 | georg.brandl | 2010-10-17 13:03:22 +0200 (So, 17 Okt 2010) | 1 line

  #5121: fix claims about default values leading to segfaults.
........
  r85636 | georg.brandl | 2010-10-17 13:06:14 +0200 (So, 17 Okt 2010) | 1 line

  #9237: document sys.call_tracing().
........
  r85638 | georg.brandl | 2010-10-17 13:13:37 +0200 (So, 17 Okt 2010) | 1 line

  Port changes to pickle docs apparently lost in py3k.
........
  r85639 | georg.brandl | 2010-10-17 13:23:56 +0200 (So, 17 Okt 2010) | 1 line

  Make twisted example a bit more logical.
........
  r85641 | georg.brandl | 2010-10-17 13:29:07 +0200 (So, 17 Okt 2010) | 1 line

  Fix documentation of dis.opmap direction.
........
  r85642 | georg.brandl | 2010-10-17 13:36:28 +0200 (So, 17 Okt 2010) | 1 line

  #9730: fix example.
........
2010-11-26 08:49:15 +00:00
Éric Araujo da825ab2dd Merged revisions 86670 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r86670 | eric.araujo | 2010-11-22 04:09:19 +0100 (lun., 22 nov. 2010) | 5 lines


  Remove unnecessary `object` base class in docs (#10366).

  Also add a note about inheritance from `object` being default.
........
2010-11-22 03:18:24 +00:00
Éric Araujo 28053fb174 Remove unnecessary `object` base class in docs (#10366).
Also add a note about inheritance from `object` being default.
2010-11-22 03:09:19 +00:00
Georg Brandl f41427263c #9117: fix syntax for class definition. 2010-10-17 10:38:20 +00:00
Georg Brandl 57a5e3f0e2 Merged revisions 84249,84264,84326-84327,84407,84476,84480-84482,84484,84530-84531,84553,84619,84684,84915-84916 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k

........
  r84249 | georg.brandl | 2010-08-22 01:20:01 +0200 (So, 22 Aug 2010) | 1 line

  Remove usage of rexec in tkinter demo.
........
  r84264 | georg.brandl | 2010-08-22 22:23:38 +0200 (So, 22 Aug 2010) | 1 line

  #9649: fix default value description.
........
  r84326 | georg.brandl | 2010-08-26 16:30:15 +0200 (Do, 26 Aug 2010) | 1 line

  #9689: add links from overview to in-depth class API descriptions.
........
  r84327 | georg.brandl | 2010-08-26 16:30:56 +0200 (Do, 26 Aug 2010) | 1 line

  #9681: typo.
........
  r84407 | georg.brandl | 2010-09-01 23:02:50 +0200 (Mi, 01 Sep 2010) | 1 line

  #9677: fix link.
........
  r84476 | georg.brandl | 2010-09-04 00:14:52 +0200 (Sa, 04 Sep 2010) | 1 line

  Use tabs consistently.
........
  r84480 | georg.brandl | 2010-09-04 00:33:27 +0200 (Sa, 04 Sep 2010) | 1 line

  More inclusive title.
........
  r84481 | georg.brandl | 2010-09-04 00:36:22 +0200 (Sa, 04 Sep 2010) | 1 line

  #9767: doctest run over json docs.
........
  r84482 | georg.brandl | 2010-09-04 00:40:02 +0200 (Sa, 04 Sep 2010) | 1 line

  #9760: clarify what context expression is.
........
  r84484 | georg.brandl | 2010-09-04 00:49:27 +0200 (Sa, 04 Sep 2010) | 1 line

  Fix missing word.
........
  r84530 | georg.brandl | 2010-09-05 19:07:12 +0200 (So, 05 Sep 2010) | 1 line

  #9747: fix copy-paste error in getresgid() doc.
........
  r84531 | georg.brandl | 2010-09-05 19:09:18 +0200 (So, 05 Sep 2010) | 1 line

  #9776: fix some spacing.
........
  r84553 | georg.brandl | 2010-09-06 08:49:07 +0200 (Mo, 06 Sep 2010) | 1 line

  #9780: both { and } are not valid fill characters.
........
  r84619 | georg.brandl | 2010-09-08 12:43:45 +0200 (Mi, 08 Sep 2010) | 1 line

  Add Lukasz.
........
  r84684 | georg.brandl | 2010-09-10 22:43:53 +0200 (Fr, 10 Sep 2010) | 1 line

  release() is probably not the most important method
........
  r84915 | georg.brandl | 2010-09-20 08:27:02 +0200 (Mo, 20 Sep 2010) | 1 line

  Fix typo.
........
  r84916 | georg.brandl | 2010-09-20 08:29:01 +0200 (Mo, 20 Sep 2010) | 1 line

  Mention % as string formatting.
........
2010-10-06 08:54:16 +00:00
Georg Brandl 4009c9edfc Merged revisions 82805-82806,83523-83527,83536,83538,83542,83546-83548,83550-83555,83558,83560 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k

........
  r82805 | georg.brandl | 2010-07-11 11:42:10 +0200 (So, 11 Jul 2010) | 1 line

  #7935: cross-reference to ast.literal_eval() from eval() docs.
........
  r82806 | georg.brandl | 2010-07-11 12:22:44 +0200 (So, 11 Jul 2010) | 1 line

  #9223: link to Command class reference, and move Command interface docs nearer to class docs.
........
  r83523 | georg.brandl | 2010-08-02 14:06:18 +0200 (Mo, 02 Aug 2010) | 1 line

  #9209 and #7781: fix two crashes in pstats interactive browser.
........
  r83524 | georg.brandl | 2010-08-02 14:20:23 +0200 (Mo, 02 Aug 2010) | 1 line

  #9428: fix running scripts from profile/cProfile with their own name and the right namespace.  Same fix as for trace.py in #1690103.
........
  r83525 | georg.brandl | 2010-08-02 14:36:24 +0200 (Mo, 02 Aug 2010) | 1 line

  Get rid of spurious "threading" entries in trace output.
........
  r83526 | georg.brandl | 2010-08-02 14:40:22 +0200 (Mo, 02 Aug 2010) | 1 line

  Fix softspace relic.
........
  r83527 | georg.brandl | 2010-08-02 14:48:46 +0200 (Mo, 02 Aug 2010) | 1 line

  #3821: beginnings of a trace.py unittest.
........
  r83536 | georg.brandl | 2010-08-02 19:49:25 +0200 (Mo, 02 Aug 2010) | 1 line

  #8578: mention danger of not incref'ing weak referenced object.
........
  r83538 | georg.brandl | 2010-08-02 20:10:13 +0200 (Mo, 02 Aug 2010) | 1 line

  #6928: fix class docs w.r.t. new metaclasses.
........
  r83542 | georg.brandl | 2010-08-02 20:56:54 +0200 (Mo, 02 Aug 2010) | 1 line

  Move test_SimpleHTTPServer into test_httpservers.
........
  r83546 | georg.brandl | 2010-08-02 21:16:34 +0200 (Mo, 02 Aug 2010) | 1 line

  #7973: Fix distutils options spelling.
........
  r83547 | georg.brandl | 2010-08-02 21:19:26 +0200 (Mo, 02 Aug 2010) | 1 line

  #7386: add example that shows that trailing path separators are stripped.
........
  r83548 | georg.brandl | 2010-08-02 21:23:34 +0200 (Mo, 02 Aug 2010) | 1 line

  #8172: how does one use a property?
........
  r83550 | georg.brandl | 2010-08-02 21:32:43 +0200 (Mo, 02 Aug 2010) | 1 line

  #9451: strengthen warning about __*__ special name usage.
........
  r83551 | georg.brandl | 2010-08-02 21:35:06 +0200 (Mo, 02 Aug 2010) | 1 line

  Remove XXX comment that was displayed.
........
  r83552 | georg.brandl | 2010-08-02 21:36:36 +0200 (Mo, 02 Aug 2010) | 1 line

  #9438: clarify that constant names also cannot be assigned as attributes.
........
  r83553 | georg.brandl | 2010-08-02 21:39:17 +0200 (Mo, 02 Aug 2010) | 1 line

  Remove redundant information.
........
  r83554 | georg.brandl | 2010-08-02 21:43:05 +0200 (Mo, 02 Aug 2010) | 1 line

  #7280: note about nasmw.exe.
........
  r83555 | georg.brandl | 2010-08-02 21:44:48 +0200 (Mo, 02 Aug 2010) | 1 line

  #8861: remove unused variable.
........
  r83558 | georg.brandl | 2010-08-02 22:05:19 +0200 (Mo, 02 Aug 2010) | 1 line

  #8648: document UTF-7 codec functions.
........
  r83560 | georg.brandl | 2010-08-02 22:16:18 +0200 (Mo, 02 Aug 2010) | 1 line

  #9087: update json docstrings -- unicode and long do not exist anymore.
........
2010-10-06 08:26:09 +00:00
Georg Brandl 3387f4887f #9760: clarify what context expression is. 2010-09-03 22:40:02 +00:00
Georg Brandl 65e5f80c48 #6928: fix class docs w.r.t. new metaclasses. 2010-08-02 18:10:13 +00:00