← Back to DAGDA | Support | Source: https://github.com/ncoghlan/peps/pull/2
Skip to content

Initial draft of an inline scope declaration PEP - #2

Closed
ncoghlan wants to merge 10 commits into
masterfrom
pep-578-inline-scope-declarations
Closed

ncoghlan wants to merge 10 commits into
masterfrom
pep-578-inline-scope-declarations

Conversation

@ncoghlan

Copy link
Copy Markdown
Owner

No description provided.

@ncoghlan

Copy link
Copy Markdown
Owner Author

Hey @ericsnowcurrently - this isn't urgent, but I've started drafting my replacement for PEP 577 (which I'm going to withdraw since I've decided even I don't find my arguments for it persuasive), and would be interested in feedback on whether or not it makes sense to anyone that isn't me :)

If you're wondering what the implications would be for PEP 3150, well, I'd end up withdrawing that completely, but the syntax in this new PEP would be compatible with a sublocal NAME declaration, along the same lines as nonlocal declarations.

Despite the branch name, I shouldn't claim even a tentative PEP number until
this is ready for publication.
- add the PEP 572 examples of deliberately leaking name bindings
- assorted other updates to wording and examples
@ncoghlan

ncoghlan commented Jun 19, 2018 •

Copy link
Copy Markdown
Owner Author

TODO items:

  • simplify the generator expression examples that are just exporting an alias of their iteration variable to omit the inline assignment and instead export the iteration variable directly
  • cover augmented assignments and the possibility of having them raise TargetNameError at compile time instead of UnboundLocalError at runtime
  • show an example of exporting a name rebinding from a lambda expression (but try to find one that's more meaningful than the classic closure based counter)
  • address the scoping inconsistency between comprehensions and other forms of container display as an open question (this inconsistency already exists, but without inline assignments, it's difficult to encounter accidentally)

@ncoghlan

ncoghlan commented Jul 1, 2018

Copy link
Copy Markdown
Owner Author

I'm not going to proceed with this particular idea, so closing the local PR.

@ncoghlan ncoghlan closed this Jul 1, 2018
ncoghlan pushed a commit that referenced this pull request Jun 27, 2021
See #2, python#1385 for context. Superseeds python#1565.

This is the minimal core Sphinx support part, adding a bare minimum of useful things to get Sphinx to build and deploy, whilst not affecting the current build system. There is no theming or custom parsing needed to properly deal with PEPs.

- `build.py` - build script
- `conf.py` - Sphinx configuration
- `Makefile` - new targets for Sphinx
- `.gitignore` - add ignores for `venv` and `package` directories
- `contents.rst` - Sphinx page to discover all PEPs
- `deploy-gh-pages.yaml` - builds and deploys to github pages
- `requirements.txt`
ncoghlan pushed a commit that referenced this pull request Jun 27, 2021
See #2, python#1385 for context. Superseeds python#1566.

This is the docutils parsing, transforms and writing part, building on PR python#1930. It contains a pseudo-package, `sphinx_pep_extensions`, which itself contains:

### Docutils parsing:
- `PEPParser` - collates transforms and interfaces with Sphinx core
- `PEPRole` - deals with :PEP:`blah` in RST source

### Docutils transforms:
- `PEPContents` (Creates table of contents without page title)
- `PEPFooter` (Dels with footnotes, link to source, last modified commit)
- `PEPHeaders` (Parses RFC2822 headers)
- `PEPTitle` - Creates document title from PEP headers
- `PEPZero` - Masks email addresses and creates links to PEP numbers from tables in `pep-0000.rst`

### Docutils HTML output:
- `PEPTranslator` - Overrides to the default HTML translator to enable better matching of the current PEP styles
ncoghlan pushed a commit that referenced this pull request Jun 27, 2021
See #2, python#1385 for context.

This is the RSS generation part, building on PR python#1930. It contains the logic for generating RSS

This was originally in python#1385 and python#1565, split out for ease of review
ncoghlan pushed a commit that referenced this pull request Jul 3, 2021
See #2, python#1385 for context. Superseeds python#1568.

This is the Sphinx-theming part, building on PR python#1930.

### Stylesheets:
- `style.css` - styles
- `mq.css` - media queries

### Jinja2 Templates:
- `page.html` - overarching template

### Javascript:
- `doctools.js` - fixes footnote brackets

### Theme miscellany
- `theme.conf` - sets pygments styles, theme internals
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant