Commit Graph

841 Commits

Author SHA1 Message Date
Zach Mitchell 00818c8ffd Fix typo in datamodel.rst (GH-6964)
This is a simple grammatical fix correcting "...object whose `__self__` attributes is ..." to "...object whose `__self__` attribute is ...".
2018-06-02 07:29:47 -07:00
Andrés Delfino 268cc7c3f8 Fix lambda parameters being refered as arguments (GH-7037) 2018-05-22 07:57:45 +02:00
Serhiy Storchaka f5e7b1999f
bpo-23722: Raise a RuntimeError for absent __classcell__. (GH-6931)
A DeprecationWarning was emitted in Python 3.6-3.7.
2018-05-20 08:48:12 +03:00
Serhiy Storchaka 8ae8e6af37
bpo-23722: Fix docs for future __classcell__ changes. (GH-6999) 2018-05-20 08:13:52 +03:00
Elvis Pranskevichus 63536bd286 bpo-32996: The bulk of What's New in Python 3.7 (GH-6978) 2018-05-19 23:15:06 -04:00
Ivan Levkivskyi bd5f96581b
bpo-32717: Document PEP 560 (GH-6726) 2018-05-08 19:38:41 +01:00
Brett Cannon 441d945eb3
Clarify that __path__ can't be just any value (GH-6554) 2018-04-20 16:32:46 -07:00
Serhiy Storchaka d08972fdb9
bpo-33260: Regenerate token.py after removing ASYNC and AWAIT. (GH-6447) 2018-04-11 19:15:51 +03:00
Serhiy Storchaka fe2bbb1869
bpo-32489: Allow 'continue' in 'finally' clause. (GH-5822) 2018-03-18 09:56:52 +02:00
Serhiy Storchaka 496431ffb6
bpo-26701: Improve documentation for the rounding special methods. (#6054) 2018-03-10 17:18:32 +02:00
Eric Appelt 308eab979d bpo-26701: Add documentation for __trunc__ (GH-6022)
`int` fails back to `__trunc__` is `__int__` isn't defined, so cover
that in the docs.
2018-03-10 18:44:12 +10:00
Nick Coghlan aec7532ed3
bpo-30579: Docs for dynamic traceback creation (GH-5653) 2018-02-13 18:10:58 +10:00
Cheryl Sabella d1f318105b bpo-8722: Document __getattr__ behavior with AttributeError in property (GH-4754)
When `__getattr__` is implemented, attribute lookup will always fall back to that,
even if the initial failure comes from `__getattribute__` or a descriptor's `__get__`
method (including property methods).
2018-02-05 12:03:22 +10:00
Serhiy Storchaka 07ca9afaa8
bpo-10544: Disallow "yield" in comprehensions and generator expressions. (GH-4564) 2018-02-04 10:53:48 +02:00
Cheryl Sabella b299393cc3 bpo-32735: Fix typo in f-strings datetime format specifier example (GH-5464)
The f-string example for using datetime format specifier does not match the given output.
Changed the format from %b to %B so it matches the output of "January".
2018-01-31 16:37:51 -05:00
Cheryl Sabella 85527cf50a bpo-27505: Add change notes in module attribute docs (GH-5320)
Make it clear that setting __class__ on a module has worked since 3.5,
but support for __getattr__ and __dir__ on module instances requires 3.7+

Patch by Cheryl Sabella.
2018-01-27 12:40:52 +10:00
Guido van Rossum 95e4d58913 String annotations [PEP 563] (#4390)
* Document `from __future__ import annotations`
* Provide plumbing and tests for `from __future__ import annotations`
* Implement unparsing the AST back to string form

This is required for PEP 563 and as such only implements a part of the
unparsing process that covers expressions.
2018-01-26 08:20:18 -08:00
İsmail Arılık 3764bb075a Lexical Analysis ref doc: Fix a typo in the string concatenation internal link (GH-5157)
In lexical analysis reference documentation, the internal link to
the string literal concatenation section was written as`.. _string-catenation:`.
Changed that to `.. _string-concatenation:`.
2018-01-11 22:18:54 -08:00
KatherineMichel f4e21a2a72 Improve the F-strings and format specifier documentation (GH-4931)
Mention that the format-specifier mini language in f-strings
is the same one used by str.format.
2017-12-19 13:03:09 -08:00
Antoine Pitrou 4b965930e8
bpo-32377: improve __del__ docs and fix mention about resurrection (#4927)
* Fix #32377: improve __del__ docs and fix mention about resurrection

* Mention that CPython only calls __del__ once.
2017-12-19 19:48:45 +01:00
Mariatta d924fa523d
F-strings docs: link to Format Specifiers (GH-4888)
Link to the Format Specification Mini Language section from f-strings' documentation.
2017-12-15 10:07:01 -08:00
Ivan Levkivskyi 5364b5cd75
bpo-32225: Implementation of PEP 562 (#4731)
Implement PEP 562: module __getattr__ and __dir__.
The implementation simply updates module_getattro and
module_dir.
2017-12-14 11:59:44 +01:00
Benjamin Peterson 42aa93b8ff
closes bpo-31650: PEP 552 (Deterministic pycs) implementation (#4575)
Python now supports checking bytecode cache up-to-dateness with a hash of the
source contents rather than volatile source metadata. See the PEP for details.

While a fairly straightforward idea, quite a lot of code had to be modified due
to the pervasiveness of pyc implementation details in the codebase. Changes in
this commit include:

- The core changes to importlib to understand how to read, validate, and
  regenerate hash-based pycs.

- Support for generating hash-based pycs in py_compile and compileall.

- Modifications to our siphash implementation to support passing a custom
  key. We then expose it to importlib through _imp.

- Updates to all places in the interpreter, standard library, and tests that
  manually generate or parse pyc files to grok the new format.

- Support in the interpreter command line code for long options like
  --check-hash-based-pycs.

- Tests and documentation for all of the above.
2017-12-09 10:26:52 -08:00
Serhiy Storchaka 73a7e9b10b bpo-10544: Deprecate "yield" in comprehensions and generator expressions. (GH-4579)
The current behaviour of yield expressions inside comprehensions  and
generator expressions is essentially an accident of implementation - it
arises implicitly from the way the compiler handles yield expressions inside
nested functions and generators.

Since the current behaviour wasn't deliberately designed, and is inherently
confusing, we're deprecating it, with no current plans to reintroduce it.
Instead, our advice will be to use a named nested generator definition
for cases where this behaviour is desired.
2017-12-01 14:54:17 +10:00
Berker Peksag 7c9da3e5ba
Remove redundant 'exc = True' line (GH-4357)
It can be removed after c28890fb42
2017-11-11 17:55:05 +03:00
Tom Floyer bf9d317626 bpo-31810: added missing keywords to docs. (#4140)
async and await keywords has been merged into upstream, but they are
all missing in the lexical analysis docs. This change adds them to the
appropriate keywords section in documentation.
2017-11-08 12:31:26 -05:00
Barry Warsaw 93952f8815
Fix a grammatical problem and reword for clarity. (#4257)
bpo-31936
2017-11-03 13:45:46 -07:00
Barry Warsaw 191e313820 bpo-31799: Make module.__spec__ more discoverable (#4010)
bpo-31799: Make module.__spec__ more discoverable
2017-10-17 15:52:38 -04:00
Yury Selivanov b8ab9d3fc8 bpo-31708: Allow async generator expressions in synchronous functions (#3905) 2017-10-06 02:58:28 -04:00
Yury Selivanov faa135acbf bpo-31709: Drop support for asynchronous __aiter__. (#3903) 2017-10-06 02:08:57 -04:00
kms70847 8d59aca4a9 Fix typo in Simple Statements documentation (GH-3809)
Replace "restriction" with "restrictions".
2017-09-28 12:54:48 -07:00
Guilherme Caminha 4a2d00cb45 bpo-31571: Remove duplicated info in Lexical Analysis documentation (GH-3691)
- Remove the second mention about the `u` prefix
- Remove the second mention about numeric literals do not include a sign
2017-09-25 16:16:54 -07:00
svelankar 9b47af6537 bpo-31501: Operator precedence description for arithmetic operators (#3633) 2017-09-17 17:56:16 -07:00
Mariatta 63c591c0b0 bpo-31487: Update F-strings doc example (GH-3627)
Shorten the comment to: "using integer format specifier"
2017-09-17 07:43:31 -07:00
Mariatta f361897069 Improve f-strings documentation (GH-3604)
Provide additional examples of using format specifiers in f-strings
Added examples for using integer and date format specifiers.
2017-09-16 11:46:43 -07:00
Louie Lu b8d1b9d7c6 Mention enum as an ex (#2982) 2017-09-12 21:44:14 -07:00
Nick Coghlan 5a8516701f bpo-31344: Per-frame control of trace events (GH-3417)
f_trace_lines: enable/disable line trace events
f_trace_opcodes: enable/disable opcode trace events

These are intended primarily for testing of the interpreter
itself, as they make it much easier to emulate signals
arriving at unfortunate times.
2017-09-08 10:14:16 +10:00
Benjamin Peterson 60dbed1850 link to legacy doc on the non-legacy website (#3362) 2017-09-05 16:24:39 -07:00
Benjamin Peterson 279a96206f bpo-30736: upgrade to Unicode 10.0 (#2344)
Straightforward. While we're at it, though, strip trailing whitespace from generated tables.
2017-06-22 22:31:08 -07:00
Lisa Roach 64505a1f6c bpo-30486: Allow setting cell value (#1840)
The cell_contents attribute of the cell object is now writable.
2017-06-08 14:43:26 +03:00
Mariatta 9efad1e5ae bpo-17188: add missing periods at the end of sentences (GH-1875) 2017-05-30 15:26:42 -07:00
kms70847 9c972b5780 Improve grammar in The Import System documentation (GH-1862)
Replace `an ModuleNotFoundError` with `a ModuleNotFoundError`.
Replace `an path` with `a path`.
2017-05-30 09:12:33 -07:00
Aaron Hall, MBA 2b44e302ec bpo-30449 Terse slots (#1819)
* correct __slots__ documentation with minimal changes

* add multiple inheritance info

* remove mapping from description
2017-05-25 22:33:26 -07:00
Naomi Ceder 43c8a9e39b bpo-30372: Clarify that '__builtins__' is a CPython Implementation detail (GH-1725) 2017-05-22 14:09:55 -07:00
csabella 763557eac0 bpo-17188: DOC: Document 'from None' in raise statement (#1671)
Original patch by Dennis Mårtensson.
2017-05-20 02:48:28 -04:00
delirious-lettuce 3378b2062c Fix typos in multiple `.rst` files (#1668) 2017-05-19 23:37:57 +03:00
Dominik Miedziński af34e0a07b Fix ModuleNotFoundError typo in import reference (#1606) 2017-05-16 19:40:17 +03:00
csabella 12b1c18098 bpo-30354: Update data model documentation for super() (GH-1561)
The data model section of the language reference was written well
before the zero-argument form of super() was added.

To avoid giving the impression that they're doing something
unusual, this updates the description of `__new__` and `__init__`
to use the zero-argument form.

Patch by Cheryl Sabella.
2017-05-15 13:42:00 +10:00
Serhiy Storchaka 7e19dbc92e bpo-28974: `object.__format__(x, '')` is now equivalent to `str(x)` (#506)
rather than `format(str(self), '')`.
2017-05-13 12:40:52 +03:00
Jim Fasarakis-Hilliard f34c685020 Fix a trivial typo in global section (#1497) 2017-05-08 04:36:29 -07:00
UltimateCoder 8856940cf2 bpo-28315: Improve code examples in docs (GH-1372)
Replace
   File "<stdin>", line 1, in ? 
with 
   File "<stdin>", line 1, in <module>
2017-05-03 09:46:45 -07:00
Jelle Zijlstra 2e624690bd bpo-29679: Implement @contextlib.asynccontextmanager (#360) 2017-04-30 18:25:58 -07:00
csabella c6db4811f9 bpo-30052: Link `bytes` & `bytearray` to stdtypes not functions (GH-1271)
Builtin container types have two potential link targets in the docs:

- their entry in the list of builtin callables
- their type documentation

This change brings `bytes` and `bytearray` into line with other
container types by having cross-references default to linking to
their type documentation, rather than their builtin callable entry.
2017-04-26 15:47:01 +10:00
Serhiy Storchaka 2e576f5aec bpo-30144: Import collections ABC from collections.abc rather than collections. (#1263) 2017-04-24 09:05:00 +03:00
Serhiy Storchaka 85157cd89a bpo-15718: Document the upper bound constrain on the __len__ return value. (#1256) 2017-04-23 08:37:58 +03:00
Serhiy Storchaka 997a4adea6 Remove outdated note about constraining of the bit shift right operand. (#1258)
The constrain was removed in bpo-29816.
2017-04-22 21:50:09 +03:00
cocoatomo cdcac039fb bpo-29952: Use usual terminology of dict (GH-917)
s/keys and elements/keys and values/
2017-03-31 14:48:49 +09:00
Amit Kumar 0ae7c8bd61 bpo-16011 clarify that 'in' always returns a boolean value 2017-03-28 10:13:01 -04:00
Ivan Levkivskyi fad7f15606 Remove an outdated statement in execution model docs (GH-754) 2017-03-22 17:54:53 -07:00
Mariatta d4e89287b3 bpo-28739: Document that f-strings cannot be used as docstring (GH-592) 2017-03-10 08:58:40 -08:00
Mariatta 1f5639c77f bpo-26184: import.rst: Improve versionchanged note (GH-325) 2017-02-26 13:23:38 -08:00
Mariatta 6b4a5f45e2 bpo-26184: import.rst: Improve versionchanged note (GH-277)
Mention that an ImportError is raised when exec_module() is defined, but
create_module() is not.
2017-02-26 07:36:57 -08:00
Marco Buttu 46ce7599af bpo-29648: import.rst: Add reference to create_module() (GH-290)
Add a reference to create_module(), in the first versionadded of section Loaders.
2017-02-26 07:14:45 -08:00
Jim Fasarakis-Hilliard 132ac381fe Fix small typos in expressions.rst (GH-276) 2017-02-24 12:32:54 -08:00
Martin Panter 2be9889405 Issues #12067: Merge hash recommendation from 3.5 2017-01-29 10:07:26 +00:00
Martin Panter 8dbb0ca573 Issue #12067: Recommend that hash and equality be consistent 2017-01-29 10:00:23 +00:00
Berker Peksag 406c252970 Issue #29012: Merge from 3.5 2017-01-03 03:35:49 +03:00
Berker Peksag 7b4e551091 Issue #29012: Remove another outdated information
Patch by Jim Fasarakis-Hilliard.
2017-01-03 03:34:15 +03:00
Berker Peksag a22457ecaf Issue #29012: Merge from 3.5 2017-01-02 06:01:07 +03:00
Berker Peksag 14adafd6ee Issue #29012: Remove outdated information about __bases__
Patch by Jim Fasarakis-Hilliard.
2017-01-02 06:00:35 +03:00
Martin Panter 7e930d7677 Issue #28954: Merge keyword argument syntax from 3.5 2016-12-24 10:21:30 +00:00
Martin Panter 7106a51c71 Issue #28954: Add missing comma to keyword argument syntax 2016-12-24 10:20:38 +00:00
Victor Stinner 01e4c1175f Merge 3.5 2016-12-19 13:09:55 +01:00
Victor Stinner 509476b370 doc: Suggest to hash(tuple of attr) rather than XOR
Issue #28383: __hash__ documentation recommends naive XOR to combine but this
is suboptimal. Update the doc to suggest to reuse the hash() method using a
tuple, with an example.
2016-12-19 13:09:28 +01:00
Yury Selivanov 03660041d2 Issue #28091: Document PEP 525 & PEP 530.
Patch by Eric Appelt.
2016-12-15 17:36:05 -05:00
Nick Coghlan 19d246745d Issue #23722: improve __classcell__ compatibility
Handling zero-argument super() in __init_subclass__ and
__set_name__ involved moving __class__ initialisation to
type.__new__. This requires cooperation from custom
metaclasses to ensure that the new __classcell__ entry
is passed along appropriately.

The initial implementation of that change resulted in abruptly
broken zero-argument super() support in metaclasses that didn't
adhere to the new requirements (such as Django's metaclass for
Model definitions).

The updated approach adopted here instead emits a deprecation
warning for those cases, and makes them work the same way they
did in Python 3.5.

This patch also improves the related class machinery documentation
to cover these details and to include more reader-friendly
cross-references and index entries.
2016-12-05 16:47:55 +10:00
Martin Panter 28540183c9 Another en → em dash fix for 3.6 2016-11-21 04:10:45 +00:00
Jason R. Coombs f66f03bd35 Update docs to reflect new behavior around backslashes in expressions (not allowed), matching recent changes to PEP 498. 2016-11-06 11:27:17 -05:00
Serhiy Storchaka 989db5c880 Issue #19795: Mark up None as literal text. 2016-10-19 16:37:13 +03:00
Serhiy Storchaka ecf41da83e Issue #19795: Mark up None as literal text. 2016-10-19 16:29:26 +03:00
Raymond Hettinger 0b51fd4341 merge 2016-09-11 17:24:05 -07:00
Raymond Hettinger 06e18a7c24 Issue #26511: Reference the id() function in the 'is' and 'is not' docs 2016-09-11 17:23:49 -07:00
Guido van Rossum 015d874626 Issue #28076: Variable annotations should be mangled for private names.
By Ivan Levkivskyi.
2016-09-11 09:45:24 -07:00
Brett Cannon a721abac29 Issue #26331: Implement the parsing part of PEP 515.
Thanks to Georg Brandl for the patch.
2016-09-09 14:57:09 -07:00
Eric Snow 68f4dd8b01 Doc updates for PEPs 520 and 468. 2016-09-09 11:22:14 -07:00
Guido van Rossum 6cff8744a0 Issue #27999: Make "global after use" a SyntaxError, and ditto for nonlocal.
Patch by Ivan Levkivskyi.
2016-09-09 09:36:26 -07:00
Yury Selivanov f8cb8a16a3 Issue #27985: Implement PEP 526 -- Syntax for Variable Annotations.
Patch by Ivan Levkivskyi.
2016-09-08 20:50:03 -07: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
R David Murray 110b6fecbb #27364: Deprecate invalid escape strings in str/byutes.
Patch by Emanuel Barry, reviewed by Serhiy Storchaka and Martin Panter.
2016-09-08 15:34:08 -04:00
Eric Snow 46f97b85a8 Issue #15767: Use ModuleNotFoundError. 2016-09-07 16:56:15 -07:00
Eric Snow 92a6c170e6 Issue #24254: Preserve class attribute definition order. 2016-09-05 14:50:11 -07:00
Raymond Hettinger f74c33ad5c Merge 2016-08-25 21:12:16 -07:00
Raymond Hettinger 7ea386e56e Issue 19504: Change "customise" to "customize" American spelling. 2016-08-25 21:11:50 -07:00
Guido van Rossum 97c1adf393 Anti-registration of various ABC methods.
- Issue #25958: Support "anti-registration" of special methods from
  various ABCs, like __hash__, __iter__ or __len__.  All these (and
  several more) can be set to None in an implementation class and the
  behavior will be as if the method is not defined at all.
  (Previously, this mechanism existed only for __hash__, to make
  mutable classes unhashable.)  Code contributed by Andrew Barnert and
  Ivan Levkivskyi.
2016-08-18 09:22:23 -07:00
Brett Cannon 3f63483a30 Merge for issue #27712 2016-08-12 10:57:17 -07:00
Brett Cannon 6336fb2734 Issue #27712: Fix some typos in the import docs.
Thanks to Xiang Zhang for the patch.
2016-08-12 10:56:48 -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
Nick Coghlan 607e1c4c44 Issue 27366: PEP 487 docs updates
- Porting note for type keyword arg handling
- __init_subclass__ note regarding  metaclass hint
2016-07-31 12:42:49 +10:00
Berker Peksag 01d1719062 Issue #27366: Tweak PEP 487 documentation
* Added versionadded directives
* Deleted duplicate sentence from __init_subclass__ docstring
* Modernized tests
2016-07-30 14:06:15 +03:00
Nick Coghlan d78448e912 Issue #27366: Implement PEP 487
- __init_subclass__ called when new subclasses defined
- __set_name__ called when descriptors are part of a
  class definition
2016-07-30 16:26:03 +10:00
Martin Panter 6a09315ff0 Issue #26462: Merge code block fixes from 3.5 2016-07-29 01:49:37 +00:00
Martin Panter 1050d2d0c7 Issue #26462: Doc: reduce literal_block warnings, fix syntax highlighting.
Patch by Julien Palard.
2016-07-26 11:18:21 +02:00
Martin Panter 2fec611a70 Issue #24314: Merge doc links from 3.5 2016-06-18 08:20:22 +00:00
Martin Panter bae5d81f5d Issue #24314: Fix doc links for general attributes like __name__, __dict__ 2016-06-18 03:57:31 +00:00
Martin Panter ed74e243c6 Issue #24136: Adjust f-strings doc for interable unpacking 2016-06-12 01:56:24 +00:00
Martin Panter 99cb0cda15 Issue #24136: Merge unpacking doc from 3.5 2016-06-12 01:55:03 +00:00
Martin Panter 0c0da48aed Issue #24136: Document generalized unpacking, PEP 448
Based on patches by Konstantin Molchanov and Neil Girdhar.
2016-06-12 01:46:50 +00:00
Martin Panter 5848ac2df0 Issue #15476: Merge index entries from 3.5 2016-06-09 23:36:40 +00: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
Martin Panter 7d7a11b5d7 Issue #23275: Backport target list assignment documentation fixes 2016-06-08 12:44:30 +00:00
R David Murray 3bad04ca62 Merge: #26829: Clarify that namespace is copied to a new __dict__ in instance creation. 2016-06-02 20:06:13 -04:00
R David Murray dd4fcf52f4 #26829: Clarify that namespace is copied to a new __dict__ in instance creation.
Patch by Emily Morehouse.
2016-06-02 20:05:43 -04:00
Tommy Beadle e9b8403a1f [Issue 15476] Make "code object" its own entry in the index 2016-06-02 19:26:51 -04:00
Berker Peksag 094c9c921c Issue #23275: Allow () = iterable assignment syntax
Documentation updates by Martin Panter.
2016-05-18 08:44:29 +03:00
Ned Deily 36c18956b0 Issue #27049: fix doc typo 2016-05-17 21:45:13 -04:00
Ned Deily cec95813b2 Issue #27049: fix doc typo 2016-05-17 21:44:46 -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 c499f30286 Issue #23921: Standardized documentation whitespace formatting.
Original patch by James Edwards.
2016-05-10 12:01:56 +03:00
Serhiy Storchaka dba903993a Issue #23921: Standardized documentation whitespace formatting.
Original patch by James Edwards.
2016-05-10 12:01:23 +03:00
Serhiy Storchaka a26e4b97d8 Issue #26156: Make expressions grammar description more semantically correct. 2016-05-08 22:00:09 +03:00
Serhiy Storchaka c7cc9850d4 Issue #26156: Make expressions grammar description more semantically correct. 2016-05-08 21:59:46 +03:00
Martin Panter 1ce738e08f Merge typo fixes from 3.5 2016-05-08 14:02:35 +00:00
Martin Panter f0564164ba Fix typos in comments, documentation and test method names 2016-05-08 13:48:10 +00:00
Serhiy Storchaka 1acbf853c8 Issue #26736: Used HTTPS for external links in the documentation if possible. 2016-05-07 10:49:58 +03:00
Serhiy Storchaka 6dff0205b7 Issue #26736: Used HTTPS for external links in the documentation if possible. 2016-05-07 10:49:07 +03:00
Berker Peksag c61d80cc83 Issue #18572: Remove redundant note about surrogates in string escape doc 2016-04-24 03:14:01 +03:00
Berker Peksag 4f35d79d65 Issue #18572: Remove redundant note about surrogates in string escape doc 2016-04-24 03:13:40 +03: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
Yury Selivanov 3e48b38dff Merge 3.5 (issue #25887) 2016-02-13 18:00:31 -05:00
Yury Selivanov 77c96813ab Issue #25887: Raise a RuntimeError when a coroutine is awaited more than once. 2016-02-13 17:59:05 -05:00
Martin Panter bc1ee460dc Issue #25179: Documentation for formatted string literals aka f-strings
Some of the inspiration and wording is taken from the text of PEP 498 by Eric
V. Smith, and the existing str.format() documentation.
2016-02-13 00:41:37 +00:00
Zachary Ware e922289620 Merge with 3.5 2016-02-03 22:07:08 -06:00
Zachary Ware 2b818142d1 Python for .NET has moved to Github.
Reported by Denis Akhiyarov on docs@
2016-02-03 22:05:46 -06:00
Brett Cannon 849113af6b Issue #25791: Warn when __package__ != __spec__.parent.
In a previous change, __spec__.parent was prioritized over
__package__. That is a backwards-compatibility break, but we do
eventually want __spec__ to be the ground truth for module details. So
this change reverts the change in semantics and instead raises an
ImportWarning when __package__ != __spec__.parent to give people time
to adjust to using spec objects.
2016-01-22 15:25:50 -08:00
Brett Cannon 63b8505281 Issue #25791: Raise an ImportWarning when __spec__ or __package__ are
not defined for a relative import.

This is the start of work to try and clean up import semantics to rely
more on a module's spec than on the myriad attributes that get set on
a module. Thanks to Rose Ames for the patch.
2016-01-15 13:33:03 -08:00
Brett Cannon 3ad18dc7a7 Merge for issue #25500 2015-12-04 14:52:07 -08:00
Brett Cannon f4f25fe576 Issue #25500: Fix the language reference to not claim that import
statements search for __import__ in the global scope.

Thanks to Sergei Lebedev for finding the documentation bug.
2015-12-04 14:51:26 -08:00
R David Murray 3129571fb1 Merge: #25679: spelling fix 2015-11-20 09:59:19 -05:00
R David Murray 0aaeacb3f1 Merge: #25679: spelling fix 2015-11-20 09:58:51 -05:00
R David Murray 51d3f8b0ba #25679: spelling fix 2015-11-20 09:57:20 -05:00
Martin Panter e56a919100 Issue #25523: Merge a-to-an corrections from 3.5 2015-11-02 04:27:17 +00:00
Martin Panter d2ad5718ad Issue #25523: Further a-to-an corrections new in 3.5 2015-11-02 04:20:33 +00:00
Berker Peksag 83356f7a3f Issue #25418: Fix markup in object.__hash__ documentation
Patch by TAKASE Arihiro.
2015-10-16 11:23:31 +03:00
Berker Peksag 85d5d902ce Issue #25418: Fix markup in object.__hash__ documentation
Patch by TAKASE Arihiro.
2015-10-16 11:23:11 +03:00
Berker Peksag edb9111d41 Issue #25418: Fix markup in object.__hash__ documentation
Patch by TAKASE Arihiro.
2015-10-16 11:22:50 +03:00
Martin Panter 430f657c67 Issue #25161: Merge full stops from 3.5 2015-10-10 10:45:00 +00:00
Martin Panter 84835ab1cb Issue #25161: Merge full stops from 3.4 into 3.5 2015-10-10 10:44:25 +00:00
Martin Panter d21e0b52f1 Issue #25161: Add full stops in documentation; patch by Takase Arihiro 2015-10-10 10:36:22 +00:00
Martin Panter 3766ee5162 Issue #12067: Merge comparisons doc from 3.5 2015-09-23 05:41:52 +00:00
Martin Panter e52c41a714 Issue #12067: Merge comparisons doc from 3.4 into 3.5 2015-09-23 05:34:48 +00:00
Martin Panter aa0da864b8 Issue #12067: Rewrite Comparisons section in the language reference
Some of the details of comparing mixed types were incorrect or ambiguous.
NotImplemented is only relevant at a lower level than the Expressions
chapter. Added details of comparing range() objects, and default behaviour
and consistency suggestions for user-defined classes. Patch from Andy Maier.
2015-09-23 05:28:13 +00: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
Robert Collins 00cf3c394a Issue #4395: Better testing and documentation of binary operators.
Patch by Martin Panter.
2015-08-07 10:32:15 +12:00
Robert Collins d84b29f805 Issue #4395: Better testing and documentation of binary operators.
Patch by Martin Panter.
2015-08-07 10:22:54 +12:00
Robert Collins 888a6729da Issue #24531: Document that encoding lines cannot follow non-comment lines.
Patch from Terry Reedy
2015-08-06 21:14:34 +12:00
Robert Collins 0b2833eaf2 Issue #24531: Document that encoding lines cannot follow non-comment lines.
Patch from Terry Reedy
2015-08-06 21:08:44 +12:00
Nick Coghlan 73c6f64a5e Merge issue #24129 from 3.4 2015-08-05 23:23:24 +10:00
Nick Coghlan 91e561aa77 Issue #24129: Clarify reference docs for name resolution.
This includes removing the assumption that readers will be familiar with the
name resolution scheme Python used prior to the introduction of lexical
scoping for function namespaces.

Patch by Ivan Levkivskyi.
2015-08-05 23:07:24 +10:00
Yury Selivanov 75b5ab5770 docs: Fix productionlist for async def functions 2015-08-01 16:19:36 -04:00
Berker Peksag a1bddadddd Issue #24713: Use importlib.reload() in import reference document.
imp.reload() was deprecated in Python 3.4 and changed to call
importlib.reload().

Patch by Petr Viktorin.
2015-07-25 13:03:08 +03:00
Berker Peksag 7e732a7181 Issue #24713: Use importlib.reload() in import reference document.
imp.reload() was deprecated in Python 3.4 and changed to call
importlib.reload().

Patch by Petr Viktorin.
2015-07-25 13:02:37 +03: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
Benjamin Peterson 47066ee3db merge 3.4 (#24610) 2015-07-11 16:33:39 -07:00
Benjamin Peterson acb3a4d88b fix normalization example (closes #24610)
Patch by Chris Angelico
2015-07-11 16:32:55 -07:00
Benjamin Peterson 4801383c29 upgrade to Unicode 8.0.0 2015-06-27 15:45:56 -05: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
Terry Jan Reedy bd44ce8ead Merge with 3.4 2015-06-12 15:45:05 -04:00
Terry Jan Reedy f5d4523844 Closes issue #24405: mark set display as code. 2015-06-12 15:44:45 -04:00
Raymond Hettinger ab89f9c27f merge 2015-05-22 16:38:16 -07:00
Raymond Hettinger 9ecf9e2944 Issue #24219: Remove duplicate literal in docs. 2015-05-22 16:37:49 -07:00
Yury Selivanov f3e40fac10 Issue 24180: Documentation for PEP 492 changes. 2015-05-21 11:50:30 -04:00
Yury Selivanov 8170e8c0d1 PEP 479: Change StopIteration handling inside generators.
Closes issue #22906.
2015-05-09 11:44:30 -04:00
Guido van Rossum 19dac071ef Issue 24088: Clarify semantics of yield expression (merge from 3.4). 2015-05-05 12:04:35 -07:00
Guido van Rossum d0150ad59e Issue 24088: Clarify semantics of yield expression. 2015-05-05 12:02:01 -07:00
Benjamin Peterson 51f58059f6 merge 3.4 (#24049) 2015-04-24 12:02:53 -04:00
Benjamin Peterson 9bdd61338d remove dead *-import checking code (closes #24049) 2015-04-24 12:02:29 -04:00
Barry Warsaw b5a3d9bebb Issue #24029: Document the name binding behavior for submodule imports. 2015-04-22 18:38:26 -04:00
Barry Warsaw 2097f53ec3 Issue #24029: Document the name binding behavior for submodule imports. 2015-04-22 18:29:16 -04:00
Brett Cannon f299abdafa Issue #23731: Implement PEP 488.
The concept of .pyo files no longer exists. Now .pyc files have an
optional `opt-` tag which specifies if any extra optimizations beyond
the peepholer were applied.
2015-04-13 14:21:02 -04:00
Berker Peksag 770319d6bd Issue #23912: Fix code formatting in datamodel.rst.
Patch by James Edwards.
2015-04-11 14:59:30 +03:00
Berker Peksag 2995cc6855 Issue #23912: Fix code formatting in datamodel.rst.
Patch by James Edwards.
2015-04-11 14:59:50 +03:00
Zachary Ware 4785f5e249 Merge with 3.4 2015-02-19 22:15:54 -06:00
Zachary Ware 57c616f1e4 Fix a typo pointed out on docs@ 2015-02-19 22:15:36 -06:00
Ethan Furman e62430eda4 Issue22988: clarify yield and exception blocks 2015-01-14 22:26:04 -08:00
Ethan Furman 2f825af728 Issue22988: clarify yield and exception blocks 2015-01-14 22:25:27 -08:00
Ethan Furman 9fdb0fe17b Issue20467: clarify __init__'s role 2015-01-14 21:57:15 -08:00
Ethan Furman 845d33c526 Issue20467: clarify __init__'s role 2015-01-14 21:56:49 -08:00
Ethan Furman 119479f705 Issue20467: clarify __init__'s role 2015-01-14 21:56:10 -08:00
Brett Cannon 02d8454002 Issue #23014: Make importlib.abc.Loader.create_module() required when
importlib.abc.Loader.exec_module() is also defined.

Before this change, create_module() was optional **and** could return
None to trigger default semantics. This change now reduces the
options for choosing default semantics to one and in the most
backporting-friendly way (define create_module() to return None).
2015-01-09 11:39:21 -05:00
Terry Jan Reedy b67f6e27e1 Issue #23006: Improve the documentation and indexing of dict.__missing__.
Add an entry in the language datamodel special methods section.
Revise and index its discussion in the stdtypes mapping/dict section.
2014-12-10 18:38:19 -05:00
R David Murray c9f5f2ddc7 #22918: Drop obsolete mention of 'keys' in datamodel __iter__ docs.
Patch by Chaitanya Agrawal.
2014-12-10 09:51:01 -05:00
Ethan Furman b004943e9b (3.4) Issue22780: reword NotImplemented docs to emphasise should 2014-11-26 21:15:35 -08:00
Terry Jan Reedy e6b2b78a7d Merge 3.4 2014-12-10 18:39:45 -05:00
R David Murray 892dbd18e1 Merge: #22918: Drop obsolete mention of 'keys' in datamodel __iter__ docs. 2014-12-10 09:51:27 -05:00
Ethan Furman 9b55089999 Issue22780: reword NotImplemented docs to emphasise should 2014-11-26 21:17:53 -08:00
Brett Cannon b6e2556d8f Issue #22834: Have import suppress FileNotFoundError when the current
working directory no longer exists.

Thanks to Martin Panter for the bug report.
2014-11-21 12:19:28 -05:00
Brett Cannon d0c4ef175b Issue #22242: Try to make some import-related loader details clearer.
Thanks to Jon Poler for pointing this out.
2014-11-07 11:29:33 -05:00
Georg Brandl e21a531ef1 merge with 3.4 2014-10-31 10:39:29 +01:00
Georg Brandl a4c8c47961 #22613: remaining corrections in extending/reference docs (thanks Jacques Ducasse) 2014-10-31 10:38:49 +01:00
Georg Brandl 794e9bf1fe merge with 3.4 2014-10-29 10:27:06 +01:00
Georg Brandl 525d355984 Fixing broken links in doc, part 3: the rest 2014-10-29 10:26:56 +01:00
Georg Brandl cadc3fdcb5 Merge with 3.4 2014-10-29 08:37:29 +01:00
Georg Brandl e73778c1ac Use https:// URLs when referring to python.org hosts. 2014-10-29 08:36:35 +01:00
Ethan Furman 58b2ddf392 Issue7186: document that __doc__ is not inherited by subclasses 2014-10-17 22:25:47 -07:00
Ethan Furman f87f515057 Issue7186: document that __doc__ is not inherited by subclasses 2014-10-17 22:25:22 -07:00
R David Murray 2623a5db6f Merge: #18176: Change generic UCD PropList link to version specific link. 2014-10-09 20:47:31 -04:00
R David Murray 5f16f90d1b #18176: Change generic UCD PropList link to version specific link. 2014-10-09 20:45:59 -04:00
R David Murray 532783bd5e Merge: #18176: fix another reference and add it to the makeunicodedata comment. 2014-10-09 17:41:55 -04:00
R David Murray 5bd62420f4 #18176: fix another reference and add it to the makeunicodedata comment. 2014-10-09 17:39:48 -04:00
Terry Jan Reedy cd09571894 Merge with 3.4 2014-09-30 19:08:02 -04:00
Terry Jan Reedy b6271f2d2b Issue 22465: grammar, number agreement. 2014-09-30 19:07:49 -04:00
Serhiy Storchaka 1aca6e1a91 Issue #20643: Removed unneeded (and wrong) class directives. 2014-09-05 23:28:19 +03:00
Serhiy Storchaka 848c8b29f6 Issue #20643: Removed unneeded (and wrong) class directives. 2014-09-05 23:27:36 +03:00
Terry Jan Reedy 523136937f Merge with 3.4 2014-08-23 19:29:58 -04:00
Terry Jan Reedy 65e3ecb3e2 Issue #22243: fix except grammar in reference. 2014-08-23 19:29:47 -04:00
Benjamin Peterson bd592417f4 add matrix multiplication operator to correct lists (closes #22142) 2014-08-06 22:50:30 -07:00
Nick Coghlan e2197a4805 Merge issue #21667 from 3.4 2014-06-07 23:22:06 +10:00
Nick Coghlan 1462786f00 Issue #21667: Clarify string data model description 2014-06-07 23:21:14 +10:00
R David Murray cc568b1222 Merge #21662: fix typo, improve sentence flow 2014-06-05 15:32:34 -04:00
R David Murray 2c0781853a #21662: fix typo, improve sentence flow
Patch by Steve Dougherty.
2014-06-05 15:31:56 -04:00
Zachary Ware b369f5875c Issue #21439: Merge with 3.4 2014-06-03 09:34:39 -05:00
Zachary Ware 2f78b84c47 Issue #21439: Fix a couple of typos. 2014-06-03 09:32:40 -05:00
Raymond Hettinger a73a34d176 merge 2014-05-26 22:21:11 -07:00
Raymond Hettinger aa7886dd3f Issue 21439: Minor issues in the reference manual.
(Contributed by Feliks Kluzniak.)
2014-05-26 22:20:37 -07:00
Benjamin Peterson 384a3ea5c5 merge 3.4 2014-05-11 11:19:17 -07:00
Benjamin Peterson 5c8ce188ee remove confusing delete indexing (closes #21466) 2014-05-11 11:18:51 -07:00
Zachary Ware ed49265b91 Merge with 3.4 2014-05-06 09:19:16 -05: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 4e6688d2b2 Issue #21366: Document the fact that ``return`` in a ``finally`` clause
overrides a ``return`` in the ``try`` suite.
2014-05-06 09:07:51 -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 727a463aa6 Merge with 3.4 2014-04-29 01:19:41 -04:00
Terry Jan Reedy 9cc9026294 Issue #21055: Index (augmented) assignment symbols. 2014-04-29 01:19:17 -04:00
Terry Jan Reedy e9dcfd1870 Merge with 3.4 2014-04-29 00:59:19 -04:00
Terry Jan Reedy 7c895edabc Closes 21048: Index 'as' in import and with statements. 2014-04-29 00:58:56 -04:00
R David Murray f7f981829b #18628: clarify index entry for source file encoding declaration.
Patch by Sam Lucidi.
2014-04-16 21:48:04 -04:00
R David Murray 16b8c619cd Merge: #18628: clarify index entry for source file encoding declaration. 2014-04-16 21:50:25 -04:00
Benjamin Peterson d51374ed78 PEP 465: a dedicated infix operator for matrix multiplication (closes #21176) 2014-04-09 23:55:56 -04:00
Yury Selivanov 490a72e022 docs: Better wording for __objclass__ docs. Issue #19281 2014-04-08 14:01:12 -04:00
Yury Selivanov b9aa8cb0c7 docs: Document __objclass__. Closes #19281.
Initial patch by Nick Coghlan
2014-04-08 12:04:04 -04:00
Yury Selivanov af8a4dfb04 docs: Better wording for __objclass__ docs. Issue #19281 2014-04-08 14:00:35 -04:00
Yury Selivanov d3f918ca44 docs: Document __objclass__. Closes #19281.
Initial patch by Nick Coghlan
2014-04-08 12:03:07 -04:00
Nick Coghlan 9aa00d1cd1 Issue #19697: document more __main__.__spec__ quirks 2014-03-29 15:39:42 +10:00
Eric Snow e50f9aa4bd Issue #19697: Document cases where __main__.__spec__ is None. 2014-03-28 18:10:33 -06:00