Questions tagged [pep]

Python Enhancement Proposals are used to propose and document Python language features, development processes and best practices. Use [pep8] for questions about the style guide for Python code.

Python Enhancement Proposals are used to propose and document Python language features, development processes and best practices.

Some important PEPs are:

At a given moment, the status of a PEP can be any one of Draft, Deferred, Accepted, Rejected, Withdrawn, Accepted, Final or Replaced. Informational PEPs which are expected to continue being updated may alternatively have a status of Active.

This flowchart shows how the status of a PEP may evolve:

enter image description here

A public Mercurial repository contains a record of changes to PEPs.

Use for questions about the style guide for Python code.

211 questions
4
votes
0 answers

What is the system-provided certificate database (Python PEP 476)?

Extract from PEP 476: This PEP proposes using the system-provided certificate database. Previous discussions have suggested bundling Mozilla's certificate database and using that by…
Astrophe
  • 463
  • 1
  • 5
  • 20
4
votes
1 answer

Any reason to put code before the docstring in Python?

I see in some other people's Python code that they paste some checks before the docstring of the function; something like this: def func(args): if x_version != 1.7: return """docstring is here""" # function body code # ... Are there any…
Alex Tereshenkov
  • 2,622
  • 5
  • 27
  • 48
4
votes
2 answers

function annotations in python

I just discovered function annotations for python 3 (https://www.python.org/dev/peps/pep-3107/) which seems great for documenting parameters or return types. It also makes better intellisense available in my pycharm IDE. I have a question regarding…
Luca
  • 8,260
  • 12
  • 71
  • 167
4
votes
3 answers

Python - most convenient way to define constant variables used just once

Let's say I have a file "icon.ico" and an url "url.com". The'll be used just once within the class - "icon.ico" will be set to some window and we'll do the request to url in one method. I have three ways to define these variables. 1-st way - define…
GriMel
  • 1,872
  • 3
  • 19
  • 36
4
votes
1 answer

No lxml Wheel for Linux?

The lxml project has decided to not provide a Wheel for lxml on Linux: https://bugs.launchpad.net/lxml/+bug/1176147 I am neither an expert on PEP 427 or lxml's dependencies, so I'm hoping someone can explain why or why not the lxml team's concerns…
Charles Offenbacher
  • 2,844
  • 2
  • 24
  • 38
4
votes
2 answers

Why do future_statements in Python need to be placed before everything?

PEP 236 states clearly that all future_statements must appear near the top of a module, with only comments, docstrings and the like allowed before them. I understand that this isn't debatable as a programming practice - it's the rules and they're…
mechalynx
  • 1,228
  • 1
  • 9
  • 22
4
votes
1 answer

Why `.` in PEP 0263 regex?

In PEP 0263 the format for defining the encoding of a Python file is defined as: coding[:=]\s*([-\w.]+) Why is there a . in the regex, or alternatively, why is there - and \w? So far as I understand, the . matches any character except a newline, so…
dotancohen
  • 26,432
  • 30
  • 122
  • 179
4
votes
1 answer

Why do Python generator functions not have a syntactically different notation from 'regular' functions?

I am wondering, after reading about generators in Improve Your Python: 'yield' and Generators Explained, but not having experimented with them yet, why the syntactic notation for a generator function is not different from that of a regular function.…
Michael Trouw
  • 4,268
  • 3
  • 25
  • 41
3
votes
1 answer

What does the PEP's status and structure mean?

What is the PEP status' structure and mean? These days, I try to write a python2.7 interpreter. But, I don't know why comparison operator <> arise in python 2.7. (It was not in python 3.0) Figure out it was in the PEP401. The official declarations…
chao787
  • 1,430
  • 2
  • 16
  • 19
3
votes
0 answers

What does the `return +self` do?

In PEP 3141 I noticed a peculiar fragment which I don't fully understand. In class Real functions real() and conjugate() return +self, like so: @property def real(self): return +self Why is there a + in front of self? What does it do? Or is it…
alex
  • 9,184
  • 12
  • 64
  • 86
3
votes
1 answer

PEP508: why either version requirement or URL but not both?

When configuring install_requires=[...] in a setup.py file, we can specify either version numbers: package >= 1.2.3 or a source: package @ git+https://git.example.com/some/path/to/package@master#egg=package But I did not manager to specify both, I…
VPfB
  • 10,146
  • 1
  • 28
  • 54
3
votes
1 answer

pip failing to build wheels for scipy

I've just downloaded the new python 3.8 and I'm trying to install the scipy package using the following: pip3.8 install scipy However the build fails with the following error: **Failed to build scipy** **ERROR: Could not build wheels for scipy…
alex_lewis
  • 2,491
  • 3
  • 17
  • 47
3
votes
1 answer

How can an assignment statement "x = y := f(x)" be done when using assignment expressions in Python?

I read in Twitter: #Python news: Guido accepted PEP 572. Python now has assignment expressions. if (match := (pattern.search) pattern.search(data)) is not None: print((match.group) mo.group(1)) filtered_data = [y for x in data if (y :=…
fedorqui 'SO stop harming'
  • 228,878
  • 81
  • 465
  • 523
3
votes
1 answer

Are Python PEPs public domain?

I'm new to programming and was wondering if I would ever run into any copyright issues with PEPs and what the guidelines are with code and intellectual property.
Aaron Mazie
  • 599
  • 5
  • 13
3
votes
2 answers

PEP 333 Application Instances and Objects

I have recently been trying to learning about WSGI and moreover, how the web works in regards to Python. So I've been reading through Werkzeug and PEP333 to learn. However I've run up against a small question, that I think I understand but probably…
John Von Neumann
  • 547
  • 3
  • 14