Commit Graph

679 Commits

Author SHA1 Message Date
Adorilson Bezerra 89294e30ff
Doc: errors tutorial improvements (GH-16269)
Improvements:

- Improvements in how try clause works section
  This suggestion is because the execution continues after *except*, not after *try* but before *except*. I guess this form more clear.

- Surrounding some keywords with \*...\*
  For uniformity the highlighted terms  

- Adjust the number of chars per line to 80
2021-01-30 22:07:11 -08:00
Vladimir 3f9fe23c05
bpo-42179: Clarify exception chaining (GH-23160)
* Update errors.rst

Clarify exception chaining behaviour and give a reference to the library documentation.

* Update errors.rst

Wording

* Update errors.rst

Spelling

* Update errors.rst

Remove mentioning of special attributes as folks think it's too much for beginners.
2020-12-15 18:47:26 -08:00
Zackery Spytz d41ec65ab7
bpo-42489: Fix the signature for list.sort() in the tutorial (GH-23538) 2020-11-28 16:53:39 +02:00
Volker-Weissmann c8aaf71dde
bpo-17852: Doc: Fix the tutorial about closing files (GH-23135)
Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2020-11-27 09:41:32 +09:00
Inada Naoki bde33e428d
bpo-42179: Doc/tutorial: Remove mention of __cause__ (GH-23162) 2020-11-06 11:45:01 +09:00
Andre Delfino c8bb24166e
[doc] Update references to NumPy (GH-22458)
Numeric(al) Python to NumPy. It seems the old name hasn't been used for some time.
2020-10-01 16:22:14 -07:00
Andre Delfino e8a2076e14
Revert "Fix all Python Cookbook links (#22205)" (GH-22424)
This commit reverts commit ac0333e1e1 as the original links are working again and they provide extended features such as comments and alternative versions.
2020-09-27 01:47:25 +01:00
Andre Delfino ac0333e1e1
Fix all Python Cookbook links (#22205) 2020-09-15 21:13:26 +01:00
Neeraj Samtani 7bcc6456ad
bpo-41776: Revise example of "continue" in the tutorial documentation (GH-22234)
Revise example of "continue" in the tutorial documentation
2020-09-15 09:39:29 -04:00
Denis Ovsienko 0be7c216e1
Fix grammar in Doc/tutorial/controlflow.rst (GH-21885)
Automerge-Triggered-By: @csabella
2020-08-19 04:29:47 -07:00
Victor Stinner bb0b08540c
bpo-40204: Fix reference to terms in the doc (GH-21865)
Sphinx 3 requires to refer to terms with the exact case.

For example, fix the Sphinx 3 warning:

Doc/library/pkgutil.rst:71: WARNING: term Loader not found in case
sensitive match.made a reference to loader instead.
2020-08-14 12:20:05 +02:00
Paul McMillan 4f28f75dee
Fix repeated words in Classes tutorial (GH-21455)
The phrase "At any time during execution," was repeated twice.

Automerge-Triggered-By: @Mariatta
2020-07-13 18:26:23 -07:00
Joannah Nanjekye d12af71047
bpo-28681: Clarify multiple function names in the tutorial (GH-21340)
* improve control flow docs

* Add also

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2020-07-05 22:47:15 -03:00
Joannah Nanjekye 9ed3cd8ba0
bpo-26205: Specify the number of nested scopes (GH-21324)
* Clarify number of scopes

* Indicate 3 or 4

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2020-07-05 22:42:24 -03:00
Adorilson Bezerra eaca2aa117
Improve IO tutorial's "Old string formatting" section (GH-16251)
* Use a more universal explanation of string interpolation rather than specifically referencing sprintf(), which depends on the reader having a C background.


Co-authored-by: Kyle Stanley <aeros167@gmail.com>
2020-05-27 21:34:01 -04:00
Antoine 6fad3e6b49
bpo-40552 Add 'users' variable in code sample (tutorial 4.2). (GH-19992)
* Add 'users' variable in code sample.

* 📜🤖 Added by blurb_it.

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2020-05-22 21:29:34 -03:00
Pablo Galindo d4fe098d1e
Python 3.10.0a0 (GH-20198) 2020-05-19 03:33:01 +01:00
Rahul Kumaresan eefd4e0333
bpo-39705 : sorted() tutorial example under looping techniques improved (GH-18999) 2020-05-17 18:32:34 -07:00
Noah Doersing 8bcfd31cc0
Change 'exception happened' to 'exception occurred' in two places (#19767) 2020-04-30 21:30:10 -07:00
Antoine e5e56328af
bpo-39869: Fix typo in 'Instance objects' section. (GH-18889) 2020-03-10 07:17:40 -07:00
Don Kirkby 3ed4d25158
Grammar fix in tutorial (GH-18425) 2020-02-09 19:57:46 -05:00
Julien Palard 446463f8db
bpo-39534: Doc: Clarify return in finally (GH-18324) 2020-02-06 23:16:48 +01:00
Adorilson Bezerra 5807efd4c3
bpo-38558: Link to further docs from walrus operator mention in tutorial (GH-16973) 2020-02-03 18:11:19 +01:00
Shanavas M 7142df5ea2 bpo-39431: Also mention nonlocal in assignment quirk (GH-17375) 2020-01-23 13:09:21 -05:00
Raymond Hettinger 04c79d6088
bpo-38678: Improve argparse example in tutorial (GH-17207) 2019-11-17 22:06:19 -08:00
Jules Lasne (jlasne) 5e01a6542a Update interpreter.rst (GH-17059)
Fixed what seemed to be a weird phrasing.
2019-11-05 14:20:38 +01:00
Ammar Askar cb2cf06b0a bpo-38558: Mention `:=` in conditions tutorial (GH-16919) 2019-10-25 17:20:05 -05:00
Mohammad Dehghan 1ad7be2f16 bpo-38130: Fix error in explaining when an exception is re-raised (GH-16016)
Co-Authored-By: Ashwin Ramaswami <aramaswamis@gmail.com>
2019-09-26 11:09:05 +02:00
Jason Plurad 9ab6038fe8 Doc: Corrected syntax for return annotation (GH-16265)
Signed-off-by: Jason Plurad <pluradj@us.ibm.com>
2019-09-19 07:24:29 +02:00
Diego Alberto Barriga Martínez b57481318e bpo-37904: Edition on python tutorial - section 4 (GH-16169)
A little change on first paragraph of python tutorial to be more clearly



https://bugs.python.org/issue37904



Automerge-Triggered-By: @ericvsmith
2019-09-17 09:57:55 -07:00
Adorilson Bezerra f18242be16 Doc: Add link of GNU Readline library to interpreter tutorial (GH-16152) 2019-09-16 18:18:04 +02:00
Adorilson Bezerra b7af4e7565 Doc: remove duplicate word in controlflow tutorial (GH-16163) 2019-09-16 09:04:58 +02:00
Kyle Stanley ff603f6c3d bpo-37635: Update arg name for seek() in IO tutorial (GH-16147)
Typically, the second positional argument for ``seek()`` is *whence*. That is the POSIX standard name (http://man7.org/linux/man-pages/man3/lseek.3p.html) and the name listed in the documentation for ``io`` module (https://docs.python.org/3/library/io.html#io.IOBase.seek). 

The tutorial for IO is the only location where the second positional argument for ``seek()`` is referred to as *from_what*. I suspect this was created at an early point in Python's history, and was never updated (as this section predates the GitHub repository):

```
$ git grep "from_what"
Doc/tutorial/inputoutput.rst:To change the file object's position, use ``f.seek(offset, from_what)``.  The position is computed
Doc/tutorial/inputoutput.rst:the *from_what* argument.  A *from_what* value of 0 measures from the beginning
Doc/tutorial/inputoutput.rst:the reference point.  *from_what* can be omitted and defaults to 0, using the
```

For consistency, I am suggesting that the tutorial be updated to use the same argument name as the IO documentation and POSIX standard for ``seek()``, particularly since this is the only location where *from_what* is being used.

Note: In the POSIX standard, *whence* is technically the third positional argument, but the first argument *fildes* (file descriptor) is implicit in Python.


https://bugs.python.org/issue37635
2019-09-14 13:29:23 -07:00
toonarmycaptain 0cc27417f2 Improve clarity of try-return-finally-return (GH-15677)
Clarify execution in try-return-finally-return case.
2019-09-11 17:37:13 +02:00
William Andrea faff81c05f Correct info about "f.read(size)". (GH13852)
In text mode, the "size" parameter indicates the number of characters, not bytes.
2019-09-10 15:50:26 +01:00
Raymond Hettinger 69ee87e99c
bpo-14112: Allow beginners to explore shallowness in greater depth ;-) (GH-15465) 2019-08-24 11:15:44 -07:00
Raymond Hettinger 6fcb6cfb13
bpo-30826: Improve control flow examples (GH-15407) 2019-08-22 23:44:19 -07:00
Raymond Hettinger 483ae0cf1d
bpo-12634: Clarify an awkward section of the tutorial (GH-15406) 2019-08-22 23:27:04 -07:00
Raymond Hettinger 4109263a7e
bpo-14050: Note that not all data can be sorted (GH-15381) 2019-08-22 09:11:35 -07:00
Abhilash Raj dcfe111eb5 bpo-37826: Document exception chaining in Python tutorial for errors. (GH-15243)
https://bugs.python.org/issue37826
2019-08-14 14:11:32 -07:00
mental 2491134029 bpo-37726: Prefer argparse over getopt in stdlib tutorial (#15052) 2019-08-01 07:17:30 -07:00
Julien Palard 2da622ff77
Doc: Fix: Proper UpperCamelCase and lowercase. (GH-14644)
Initial report by Michael Blankenship on docs@
2019-07-08 23:06:32 +02:00
Brett Cannon f9f8e3ce70
bpo-37403: Touch up venv docs (GH-14458)
Add a versionadded for PS Core and note that `.venv` is a common virtual environment name.
2019-06-28 12:14:31 -07:00
Steve Dower 7a177c08ab
Improve Windows commands in tutorial (GH-14379) 2019-06-26 08:55:57 -07:00
Xtreak 080b6b40fa bpo-37392: Update the dir(sys) in module tutorial (GH-14365) 2019-06-25 14:16:54 +02:00
Brad 8b2aa1fdde Use `python -m pip install` in porting guide and venv docs (GH-13257)
This is to help prevent people from accidentally installing into the wrong Python interpreter if they are not aware of which Python interpreter `pip` points to.
2019-06-21 11:20:21 -07:00
Łukasz Langa 9ab2fb1c68
Bump to 3.9.0a0 2019-06-04 22:12:32 +02:00
Marco Buttu 218e47b618 bpo-29414: Change 'the for statement is such an iterator' in Tutorial (GH-273) 2019-06-01 14:11:47 -07:00
pbhd e1f95e77e0 bpo-36739: Update controlflow.rst (GH-12983)
in addition to global-statement also mention nonlocal-statement
(in the paragraph describing access to variables which are non local to a function
2019-05-28 20:38:03 -07:00
Pablo Galindo b76302ddd0 bpo-36540: Documentation for PEP570 - Python positional only arguments (#13202)
* bpo-36540: Documentation for PEP570 - Python positional only arguments

* fixup! bpo-36540: Documentation for PEP570 - Python positional only arguments

* Update reference for compound statements

* Apply suggestions from Carol

Co-Authored-By: Carol Willing <carolcode@willingconsulting.com>

* Update Doc/tutorial/controlflow.rst

Co-Authored-By: Carol Willing <carolcode@willingconsulting.com>

* Add extra bullet point and minor edits
2019-05-28 16:45:32 -07:00
Julien Palard 51ddab8dae
Doc: Add missing forward reference in the tutorial. (GH-13499) 2019-05-28 15:10:23 +02:00
Utkarsh Gupta 3e2afd78ba bpo-36008: Doc update for 3.8 migration (GH-12887) 2019-05-13 08:29:39 -04:00
Adorilson Bezerra e19a91e45f Add a footnote about Cheese Shop in Doc/tutorial (GH-13103) 2019-05-07 16:20:58 -04:00
Jonatan 98a1e06c47 bpo-36189: Fixing typo in tutorial introduction (GH-13090) 2019-05-04 17:55:29 -04:00
Utkarsh Gupta ee0309f3d8 closes bpo-35329: Change 'Package' to 'package' in accordance with PEP8. (GH-13008) 2019-04-29 19:20:06 -07:00
Colin Watson 71ce03df9c Clarify file-closing example in tutorial (GH-11652) 2019-04-17 08:18:37 -04:00
Inada Naoki 5410d3d283
better __init__.py explanation in tutorial (#12763)
* better __init__.py explanation in tutorial

* Update Doc/tutorial/modules.rst

Co-Authored-By: methane <songofacandy@gmail.com>
2019-04-11 15:10:35 +09:00
Emmanuel Arias b00479d42a bpo-36377: Specify that range() can not be compared (GH-12468) 2019-04-01 21:52:42 -07:00
Raymond Hettinger fb28fcc925
Revert "Minor doc improvement (GH-10341)" (GH-12597)
This reverts commit dfd775a0b1.
2019-03-27 21:03:02 -07:00
Andre Delfino dfd775a0b1 Minor doc improvement (GH-10341)
Change "star-operator" to "* operator".
2019-03-26 21:17:50 -04:00
Ned Deily 6661c1720e
Replace "DOS box" with link to Windows FAQ. (GH-12390) 2019-03-24 15:03:54 -04:00
Cheryl Sabella b7105c9c96 bpo-35566: Add links to annotation glossary term (GH-11291) 2018-12-23 21:09:09 -08:00
Serhiy Storchaka 2b57c43f21
bpo-35506: Remove redundant and incorrect links from keywords. (GH-11174) 2018-12-19 08:09:46 +02:00
Andrés Delfino c5eec4426d Add a reference to the name mangling description in the tutorial to the index. (GH-10138) 2018-11-07 19:59:45 +02:00
İsmail Arılık fe62d877e3 Fix a typo about a comma. (GH-10306) 2018-11-03 17:05:59 +02:00
Serhiy Storchaka 3f819ca138
bpo-35110: Fix unintentional spaces around hyphens and dashes. (GH-10231) 2018-10-31 02:26:06 +02:00
Serhiy Storchaka 913876d824
bpo-35054: Add yet more index entries for symbols. (GH-10121) 2018-10-28 13:41:26 +02:00
Stéphane Wirtel e483f02423 bpo-35044, doc: Use the :exc: role for the exceptions (GH-10037) 2018-10-26 12:52:11 +02:00
Serhiy Storchaka ddb961d2ab
bpo-35054: Add more index entries for symbols. (GH-10064) 2018-10-26 09:00:49 +03:00
Berker Peksag 13ae4d4438 bpo-21196: Clarify name mangling rules in tutorial (GH-5667)
Initial patch by Chandan Kumar.
2018-10-20 02:33:48 +02:00
Ben Hoyt 3705b98620 bpo-34712: Fix style in examples in "Input and Output" (GH-9361)
A couple of fixes here to make this more PEP-8:

* Avoid multiple statements on one line with `;` statement separator -- this is very rare in Python and is "generally discouraged" in PEP 8 (and if used, per PEP 8 there shouldn't be a space before the `;`)
* Add output for the first "Formatted String Literals" example. (Side note: are the doctests for this being run? If so, why didn't it fail?)
* Avoid space before `!r`. I have generally not seen spaces before the `!`, and this also matches the style used in the docs here: https://docs.python.org/3/library/string.html#format-string-syntax



https://bugs.python.org/issue34712
2018-09-19 03:28:28 -07:00
Lew Kurtz f019579828 bpo-33460: remove ellipsis that look like continuation prompts (GH-7851)
Remove ellipsis that look like continuation prompts,
has a side benefit of putting rest of error message in proper text color.
2018-09-10 18:13:08 -07:00
Julien Palard 25fa141487 Doc: Missing 'f' in an f-string. (GH-9074) 2018-09-07 11:31:47 +02:00
Lysandros Nikolaou bcd1d971b6 Update list.remove(x) documentation (GH-8636)
Rephrase it to "It raises a `ValueError`"
2018-08-02 19:45:48 -07:00
Aaron Ang c0f0a7669c bpo-28677: Improve phrasing of when instance attribute is referenced (GH-6208) 2018-07-25 17:21:32 +03:00
Aaqa Ishtyaq cb5f3fdb9d Remove extra parentheses in output formatting tutorial (GH-8350)
The parentheses were incorrect.
2018-07-20 09:06:44 -07:00
Lysandros Nikolaou 9cffdbffc3 Fix documentation for input and output tutorial (GH-8231)
The ValueError message ends with a period.
2018-07-10 17:11:34 -07:00
Andrew Kuchling ced350b195
bpo-28626: rearrange discussion of output formatting to encourage f-strings (#6036)
The 'output formatting' section of the tutorial talks a lot about manual formatting with things like .rjust() and .zfill(), with only a passing reference to 3.6's new f-strings.

This doesn't drop all of the old material, but it does rearrange the topics into a more modern order: f-strings first, discussing formatting specifiers a bit; then calling .format(); finally manual formatting with .ljust().
2018-07-07 17:36:23 -04:00
Behzad B. Mokhtari df748c20da use rich markup for PEP reference (GH-7939)
it's better to refer to PEP with `pep` role in reStructuredText. It also links to the PEP page.
2018-06-26 20:57:39 -07:00
Andrés Delfino 5092439c2c bpo-33892: Doc: Use gender neutral words (GH-7770) 2018-06-18 13:34:30 +09:00
Serhiy Storchaka 0a36ac1a09
bpo-33641: Convert RFC references into links. (GH-7103)
85% of them are already links.
2018-05-31 07:39:00 +03:00
Stéphane Wirtel 19177fbd5d bpo-33503: Fix the broken pypi link in the source and the documentation (GH-6814) 2018-05-15 14:58:35 -04:00
Serhiy Storchaka ddb6215a55
bpo-13525: Fix incorrect encoding name in the tutorial example. (GH-6738) 2018-05-09 11:10:55 +03:00
Neeraj Badlani 643ff711fa Mention both relevant PEPs in function annotations tutorial (GH-6304)
Patch by Neeraj Badlani.
2018-04-25 12:52:13 -05:00
Andrés Delfino b81ca28b37 bpo-33297: Mention Pillow to work with more image formats. (#6505)
Also update PIL doc references to Pillow.
2018-04-21 15:17:26 +03:00
Serhiy Storchaka 46936d5a71
Improve highlighting of some code blocks. (GH-6401) 2018-04-08 19:18:04 +03:00
hui shang dfbbbf16f9 bpo-32337: Update documentats about dict order (GH-4973) 2018-04-04 13:55:05 +09:00
Steven M. Vascellaro 83d7062d2d controlflow: Use full example for "5 through 9" (GH-5907)
Replace example result of "5 through 9" with complete list: "5, 6, 7, 8, 9".
This format is more consistent with the surrounding examples.
2018-03-09 11:57:21 -08:00
Mario Corchero fbee88244e bpo-31454: Include information about "import X as Y" in Modules tutorial (GH-4041) 2018-02-25 11:11:12 -08:00
Cheryl Sabella 84c4b0cc67 bpo-25059: Clarify the print separator usage in tutorial (GH-5879)
By default `print` adds spaces between its arguments.
2018-02-25 11:06:01 -08:00
Stéphane Wirtel ab328756d7 bpo-32722: Remove useless example in the Classes tutorial (#5446)
In the tutorial about the Generator expression, there is an example with
a dict comprehension and not with a generator expression, just removed
the code.
2018-02-01 15:31:07 +08:00
Ned Deily 5489bdad51 Start of 3.8.0a0 2018-01-31 17:44:09 -05:00
Emily Morehouse f190eb59e6 bpo-32452: clarify term 'brackets' in generator tutorial (#5079)
Updates documentation for generator expressions in classes tutorial: Clarify usage of ambiguous term "brackets" by replacing with "square brackets". Updated subsequent lines to respect line breaks. (#5079)
2018-01-01 20:34:53 -05:00
Sanyam Khurana 1b4587a246 bpo-25910: Fixes redirection from http to https (#4674) 2017-12-06 17:39:33 +01:00
Will White 78a5722ae9 Improve the String tutorial docs (GH-4541)
The paragraph that contains example of string literal concatenation was placed
after the section about concatenation using the '+' sign.
Moved the paragraph to the appropriate section.
2017-11-24 09:28:12 -08:00
Raymond Hettinger 8c26a34f93 bpo-31757: Make Fibonacci examples consistent (#3991) 2017-10-14 07:36:08 -07:00
Trey Hunner 3fbd70018f bpo-30466: Add brief explanation of classes to tutorial (GH-1804) 2017-07-12 19:30:37 -07:00
regexaurus 36fc896740 Clarification to the `break` statement (GH-2453)
Clarify that the break statement breaks out of the innermost enclosing for or while loop.
2017-06-27 15:40:41 -07:00
Andrew Kuchling bd4e9e0ca9 bpo-6519: Improve Python Input Output Tutorial (GH-2143)
Move up the discussion about 'with' keyword, so it appears earlier in the document.
2017-06-12 22:31:01 -07:00
suketa 1dbce04d0e bpo-30621: Update Input Output Tutorial Example(GH-2074)
import json before using json module
2017-06-11 18:42:59 -07:00