Skip to content

Commit 562ecd2

Browse files
committed
Apply ZeroIntensity's PEP 843 review requests
Peter Bierma (ZeroIntensity) offered to sponsor PEP 843 and asked to be listed as its CODEOWNERS reviewer, so add both. He also flagged that several section headers had underlines longer than their titles; fix all of those to satisfy strict RST underline-length checking.
1 parent 1ac3b01 commit 562ecd2

2 files changed

Lines changed: 22 additions & 20 deletions

File tree

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,7 @@ peps/pep-0837.rst @serhiy-storchaka
715715
peps/pep-0838.rst @AlexWaygood
716716
peps/pep-0840.rst @jeremyhylton @gvanrossum
717717
peps/pep-0842.rst @ZeroIntensity
718+
peps/pep-0843.rst @ZeroIntensity
718719
# ...
719720
peps/pep-2026.rst @hugovk
720721
# ...

peps/pep-0843.rst

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
PEP: 843
22
Title: Export Statement for DRY Re-exports
33
Author: Neil Girdhar <mistersheik@gmail.com>
4+
Sponsor: Peter Bierma <peter@python.org>
45
Discussions-To: Pending
56
Status: Draft
67
Type: Standards Track
@@ -42,7 +43,7 @@ statement. Nothing is left to sync by hand, and no alias needs decoding.
4243

4344

4445
Relationship to PEP 842
45-
========================
46+
=======================
4647

4748
Both PEPs start from the same discomfort with ``__all__``, and agree on
4849
the same core mechanism for re-exports: a statement of the shape ``from
@@ -105,7 +106,7 @@ see a bare ``import x`` as unused and remove it.
105106

106107

107108
``__all__`` conflates two concerns
108-
-------------------------------------
109+
----------------------------------
109110

110111
Hand-maintained ``__all__`` also mixes two distinct concerns in one
111112
file: the list of imports (an implementation detail of how the
@@ -119,7 +120,7 @@ autofixers routinely delete it rather than surface the omission.
119120

120121

121122
Underscores solve a different problem
122-
--------------------------------------
123+
-------------------------------------
123124

124125
A natural response is: "just prefix internal names with an underscore."
125126
But the privacy this PEP cares about lives at the package level, not the
@@ -205,7 +206,7 @@ export is the use.
205206

206207

207208
Wildcard form
208-
-----------------
209+
-------------
209210

210211
This proposal also includes a wildcard form, ``from <module> export *``.
211212
It binds every name that ``from <module> import *`` would bind, using the
@@ -241,7 +242,7 @@ machinery already computes to execute a wildcard import.
241242

242243

243244
Lazy exports
244-
-----------------
245+
------------
245246

246247
:pep:`810` adds a ``lazy`` soft keyword that defers a ``from ... import``
247248
statement until the imported name is first used: ``lazy from <module>
@@ -341,7 +342,7 @@ exactly the shape a hub module (`How to Teach This`_) already takes.
341342

342343

343344
Interaction with ``__all__``
344-
-----------------------------
345+
----------------------------
345346

346347
A module may freely mix ``from ... export ...`` statements with a
347348
manually maintained ``__all__``, or with ``__all__ +=`` /
@@ -369,7 +370,7 @@ attribute-access hiding is a `non-goal <Non-goals_>`_ of this PEP.
369370

370371

371372
Semantic implementation
372-
------------------------
373+
-----------------------
373374

374375
Each ``from <module> export <name> as <alias>`` statement is equivalent
375376
to:
@@ -402,7 +403,7 @@ Rationale
402403
=========
403404

404405
Why a keyword and not a decorator
405-
-----------------------------------
406+
---------------------------------
406407

407408
A ``@public``-style decorator, as in the third-party ``atpublic``
408409
package, works neatly for individually defined functions and classes,
@@ -421,7 +422,7 @@ both problems, because it's part of the import statement itself; it
421422
adds nothing beyond the import that would exist anyway.
422423

423424
Why only re-exports
424-
-----------------------------
425+
-------------------
425426

426427
This PEP deliberately omits a way to mark a fresh ``def``, ``class``, or
427428
assignment as exported where it's defined. Some smaller libraries and
@@ -453,7 +454,7 @@ propose a definition-site marker if real-world evidence for that gap
453454
emerges; this PEP doesn't need to solve it to solve the re-export problem.
454455

455456
Why no runtime enforcement
456-
-----------------------------
457+
--------------------------
457458

458459
The author finds runtime access restriction appealing on its own merits,
459460
and excludes it here purely on scope grounds. :pep:`842` proposes exactly
@@ -479,7 +480,7 @@ with the syntax that produces that ``__all__`` in the first place.
479480

480481

481482
Backwards Compatibility
482-
========================
483+
=======================
483484

484485
``export`` is a soft keyword, following the same approach as ``match``,
485486
``case``, and ``type``. Python treats it specially only in the one
@@ -504,13 +505,13 @@ minimum supported version catches up:
504505
505506
506507
Security Implications
507-
=======================
508+
=====================
508509

509510
This PEP has no known security implications.
510511

511512

512513
How to Teach This
513-
====================
514+
=================
514515

515516
Documentation should teach ``from <module> export <name>`` as part of a
516517
named layout, the **hub-and-internals** pattern, not as an isolated
@@ -564,18 +565,18 @@ plugins.
564565

565566

566567
Reference Implementation
567-
===========================
568+
========================
568569

569570
No reference implementation exists yet. A prototype could be built as a
570571
source-to-source transform (similar to early prototypes of ``match``
571572
statements) before committing to grammar changes in CPython.
572573

573574

574575
Rejected Ideas
575-
================
576+
==============
576577

577578
Alternative surface syntax
578-
-------------------------------
579+
--------------------------
579580

580581
This PEP considered two other spellings for the re-export statement:
581582

@@ -594,10 +595,10 @@ This PEP considered two other spellings for the re-export statement:
594595

595596

596597
Open Issues
597-
=============
598+
===========
598599

599600
Should ``export *`` require the source module to define ``__all__``?
600-
---------------------------------------------------------------------
601+
--------------------------------------------------------------------
601602

602603
The two-tier layout that motivates the wildcard form (see
603604
`Specification`_) depends on the internal module having deliberately
@@ -619,7 +620,7 @@ error if it doesn't?
619620

620621

621622
Acknowledgements
622-
===================
623+
================
623624

624625
This PEP grew out of discussion on :pep:`842`, particularly
625626
contributions from Peter Bierma, Alex Grönholm, Guido van Rossum, Barry
@@ -640,7 +641,7 @@ Change History
640641

641642

642643
Copyright
643-
===========
644+
=========
644645

645646
This document is placed in the public domain or under the
646647
CC0-1.0-Universal license, whichever is more permissive.

0 commit comments

Comments
 (0)