Commit graph

657 commits

Author SHA1 Message Date
Adam Turner
8ed1d53e62
GH-138465: Improve documentation for common sequence methods (#138474)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-09-05 20:55:02 +01:00
Adorilson Bezerra
88665de120
gh-138307: Update the Ellipsis documentation (#138306)
* Doc: Change Ellipsis doc at library/constants

* Doc: Change Ellipsis doc at library/stdtypes

* Doc: Add NumPy reference into Ellipsis doc at library/stdtypes

* Doc: Add Ellipsis reference into the pass statement section at tutorial

* Doc: Update Ellipsis doc concerns assignments at library/constants

* Update Doc/library/stdtypes.rst

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>

* Doc: Fix grammar on Ellipsis docs (library/constants.rst)

Co-authored-by: Éric <merwok@netwok.org>

* Doc: Fix grammar on Ellipsis docs (library/stdtypes.rst)

Co-authored-by: Éric <merwok@netwok.org>

* Doc: Fix grammar on Ellipsis docs (library/stdtypes.rst)

Co-authored-by: Éric <merwok@netwok.org>

* Doc: Remove pretty printers reference from Ellipsis doc at library/stdtypes

* Doc: Update index concerns Ellipsis object and pass statement

* Doc: Improve Ellipsis doc at library/constants

* Doc: Improve Ellipsis doc at library/stdtypes

* Doc: Change the "..." glossary entry to mention the Ellipsis object

* Doc: Some improvements concern ellipsis into typing doc

* Minor update Doc/tutorial/controlflow.rst

Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>

* Update Doc/library/constants.rst

Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>

* Update Doc/library/stdtypes.rst

Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>

---------

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
2025-09-03 07:27:22 -04:00
Blaise Pabon
14a5ad1db1
gh-106318: Add example for str.find() (#134529)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-08-27 09:42:00 +03:00
Serhiy Storchaka
65fb4d11a0
gh-137609: Update signatures of builtins in the documentation (GH-137610)
Show signatures that match the actual signatures or future multisignatures
for all functions, classes and methods in the "builtins" module.
2025-08-25 15:28:27 +03:00
Adam Turner
4dae9b1ff1
gh-132661: PEP 750 documentation: second pass (#137020) 2025-08-04 22:45:51 +01:00
Dave Peck
22c8658906
gh-132661: Document t-strings and templatelib (#135229)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Loïc Simon <loic.pano@gmail.com>
Co-authored-by: pauleveritt <pauleveritt@me.com>
2025-07-22 12:44:13 +03:00
Yongzi Li
609d5adc7c
gh-134833: improve docs for del s[i:j] in Mutable Sequence Types (#134834) 2025-07-13 11:26:31 +05:30
Blaise Pabon
14c1d093d5
gh-106318: Add example for str.expandtabs() (#134525) 2025-06-13 18:44:21 +03:00
Blaise Pabon
eed827ed09
gh-106318: Add example for str.endswith() (#134523)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-06-13 11:54:16 +00:00
Blaise Pabon
273459562e
gh-106318: Add example for str.encode() (#134520)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-06-13 11:32:07 +00:00
Yongzi Li
158e5162bf
gh-134976: document the exception type that can be raised by s[i] (#134977) 2025-06-08 14:28:55 +02:00
Rishabh Singh
967f361993
gh-134789: Document del s[i] operation for mutable sequences (#134804)
[main] Update stdtypes.rst

- Added explicit mention of `del s[i]` (item deletion by index) to the Mutable Sequence Types section.
- Clarified that this operation removes the item at the specified index from the sequence.
- Addresses issue #134789.
2025-05-27 14:48:04 -04:00
Blaise Pabon
1729468016
gh-106318: Add example for str.count() (#134519) 2025-05-23 12:47:11 +03:00
Blaise Pabon
da9b5c1c9c
gh-106318: Add example for str.center() (#134518) 2025-05-23 12:44:15 +03:00
Joey Smith
3e23047363
gh-133986: Document string split algorithm when sep is None and maxsplit is 0 (#133987)
* Document string split algorithm when sep is None and maxsplit is 0

* Update Doc/library/stdtypes.rst

Co-authored-by: Semyon Moroz <donbarbos@proton.me>

---------

Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
Co-authored-by: Semyon Moroz <donbarbos@proton.me>
2025-05-14 06:17:26 -04:00
Yongzi Li
076004ae54
Docs: use boolean constants for returning boolean value (GH-133325) 2025-05-09 17:11:50 +03:00
Yongzi Li
61ac88c06e
gh-133361: move the explanation of dict equal before its use (#133424)
Also move up the explanation of insertion order preservation.  Both paragraphs seemed out of place down where they were.
---------

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2025-05-07 18:04:49 -04:00
Adam Turner
fee808936f
gh-85583: Add an overview of formatted string literals (f-strings) to `str` (#132689) 2025-04-21 07:49:06 +00:00
Adam Dangoor
edfbd8c062
gh-131885: Document that dict.setdefault and dict.get take no keyword arguments (#128208) 2025-03-30 09:22:57 +00:00
Andrew Svetlov
61b4b2c57c
gh-131417: Mention asyncio Future and Task in docs for generic classes list (#131422)
Mention asyncio Future and Task in docs for generic classes list
2025-03-19 10:05:23 +01:00
Hugo van Kemenade
77b2c933ca Python 3.14.0a6 2025-03-14 17:05:02 +02:00
Daniel Pope
e0637cebe5
gh-129349: Accept bytes in bytes.fromhex()/bytearray.fromhex() (#129844)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-03-12 11:40:11 +01:00
Jelle Zijlstra
dc6d66f44c
gh-105499: Merge typing.Union and types.UnionType (#105511)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Ken Jin <kenjin@python.org>
Co-authored-by: Carl Meyer <carl@oddbird.net>
2025-03-04 11:44:19 -08:00
Yuki Kobayashi
4d3a7ea354
Docs: Fix some semantic usages of iterator.__iter__ (GH-130172)
These references to an `__iter__` method mean `object.__iter__`, not `iterator.__iter__`.
2025-02-25 13:38:47 +01:00
Stan Ulbrych
3402e133ef
gh-82045: Correct and deduplicate "isprintable" docs; add test. (GH-130118)
We had the definition of what makes a character "printable" documented in three places, giving two different definitions.
The definition in the comment on `_PyUnicode_IsPrintable` was inverted; correct that.

With that correction, the two definitions turn out to be equivalent -- but to confirm that, you have to go look up, or happen to know, that those are the only five "Other" categories and only three "Separator" categories in the Unicode character database.  That makes it hard for the reader to tell whether they really are the same, or if there's some subtle difference in the intended semantics.

Fix that by cutting the C API docs' and the C comment's copies of the subtle details, in favor of referring to the Python-level docs. That ensures it's explicit that these are all meant to agree, and also lets us concentrate improvements to the wording in one place.

Speaking of which, borrow some ideas from the C comment, along with other tweaks, to hopefully add a bit more clarity to that one newly-centralized copy in the docs.

Also add a thorough test that the implementation agrees with this definition.

Author:    Greg Price <gnprice@gmail.com>

Co-authored-by: Greg Price <gnprice@gmail.com>
2025-02-14 18:16:47 +01:00
Hugo van Kemenade
3ae9101482 Python 3.14.0a5 2025-02-11 19:16:29 +02:00
Cody Maloney
5fb019fc29
gh-129559: Add bytearray.resize() (GH-129560)
Add bytearray.resize() which wraps PyByteArray_Resize.

Make negative size passed to resize exception/error rather than crash in optimized builds.
2025-02-05 11:33:17 -08:00
Cheryl Sabella
5044c2245c
gh-67748: DOC:Add summary table for str methods in stdtypes.rst (GH-1709)
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
2025-01-13 14:14:59 +01:00
Hugo van Kemenade
401bfc69d1 Python 3.14.0a3 2024-12-17 11:50:39 +02:00
Bénédikt Tran
4331832db0
gh-125420: implement Sequence.count API on memoryview objects (#125443) 2024-12-10 10:12:33 +00:00
Bénédikt Tran
58c753827a
gh-125420: implement Sequence.index API on memoryview objects (#125446) 2024-12-09 18:48:38 -08:00
Sergey B Kirpichev
987311d42e
gh-69639: Add mixed-mode rules for complex arithmetic (C-like) (GH-124829)
"Generally, mixed-mode arithmetic combining real and complex variables should
be performed directly, not by first coercing the real to complex, lest the sign
of zero be rendered uninformative; the same goes for combinations of pure
imaginary quantities with complex variables." (c) Kahan, W: Branch cuts for
complex elementary functions.

This patch implements mixed-mode arithmetic rules, combining real and
complex variables as specified by C standards since C99 (in particular,
there is no special version for the true division with real lhs
operand).  Most C compilers implementing C99+ Annex G have only these
special rules (without support for imaginary type, which is going to be
deprecated in C2y).
2024-11-26 17:57:39 +02:00
Hugo van Kemenade
add43c3420 Python 3.14.0a2 2024-11-19 16:52:44 +02:00
Prometheus3375
5527c4051c
gh-116938: Fix dict.update docstring and remove erraneous full stop from dict documentation (#125421)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2024-10-29 23:00:04 +00:00
Brian Schubert
dc76a4ad3c
gh-126012: Add __class_getitem__ to memoryview (#126013)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2024-10-27 13:36:03 +03:00
Victorien
21ac0a7f4c
gh-116938: Clarify documentation of dict and dict.update regarding the positional argument they accept (#125213)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-10-11 23:05:13 +00:00
Alex Waygood
0d9d56c4e4
gh-101100: Add a table of class attributes to the "Custom classes" section of the data model docs (#124480) 2024-09-25 19:29:58 +00:00
Benjamin Peterson
bb904e063d
closes gh-124016: update Unicode to 16.0.0 (#124017) 2024-09-13 07:47:04 -07:00
Wei-Hsiang (Matt) Wang
cf472577e2
gh-123517: Remove unnecessary `:meth:` parentheses (#123518) 2024-09-01 05:59:42 +01:00
Wei-Hsiang (Matt) Wang
103a0470e3
gh-123492: Remove unnecessary :func: parentheses (#123493) 2024-08-30 14:34:09 +03:00
Kirill Podoprigora
249b083ed8
gh-122982: Extend the deprecation period for bool inversion by two years (#123306) 2024-08-25 12:24:44 -07:00
smij720
967a4f1d18
Docs: Change remove to removes for consistency (#121072) 2024-08-07 16:30:00 +01:00
Serhiy Storchaka
1a0c7b9ba4
gh-121905: Consistently use "floating-point" instead of "floating point" (GH-121907) 2024-07-19 08:06:02 +00:00
Serhiy Storchaka
94bee45dee
gh-84978: Add float.from_number() and complex.from_number() (GH-26827)
They are alternate constructors which only accept numbers
(including objects with special methods __float__, __complex__
and __index__), but not strings.
2024-07-15 16:07:00 +00:00
Yuxin Wu
892e3a1b70
Update example of str.split, bytes.split (#121287)
In `{str,bytes}.strip(chars)`, multiple characters are not treated as a
prefix/suffix, but as individual characters. This may make users confuse
whether `split` has similar behavior.
Users may incorrectly expect that
`'Good morning, John.'.split(', .') == ['Good', 'morning', 'John']`

Adding a bit of clarification in the doc.

Co-authored-by: Yuxin Wu <ppwwyyxx@users.noreply.github.com>
2024-07-05 13:08:29 -07:00
sobolevn
1dc9a4f6b2
gh-121196: Document dict.fromkeys params as pos-only (#121197) 2024-07-01 23:27:04 +03:00
Nice Zombies
462832041e
gh-119003: Clarify slice assignments (#119935) 2024-06-21 11:30:50 -07:00
Serhiy Storchaka
08e65430aa
gh-111999: Fix the signature of str.format_map() (#119540) 2024-05-25 06:21:11 -07:00
Landon Wood
0e3c8cda1f
gh-110383: Align dict.get(), .fromkeys(), and .setdefault() docs with docstrings (#119330) 2024-05-22 01:15:40 +00:00
Nikita Sobolev
2f4db5a04d
gh-118803: Remove ByteString from typing and collections.abc (#118804) 2024-05-09 00:37:55 +01:00