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.

243 questions
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
  • 30,064
  • 36
  • 138
  • 197
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.…
Michahell
  • 4,905
  • 5
  • 29
  • 45
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,760
  • 3
  • 18
  • 20
3
votes
4 answers

ERROR: Could not build wheels for PyNaCl which use PEP 517 and cannot be installed directly

Im using the latest Version of Pycharm: When i Enter this command: pip install -U discord.py[voice] This Error Message will come: ERROR: Could not build wheels for PyNaCl which use PEP 517 and cannot be installed directly What should i do?
Joel_1930
  • 33
  • 1
  • 1
  • 6
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
  • 10,900
  • 15
  • 70
  • 100
3
votes
2 answers

PYTHON ujson. ERROR: Could not build wheels for ujson which use PEP 517 and cannot be installed directly

I`m trying to install RASA framework on my Windows laptop using Poetry and build from source. Using pip wont help me as i was never able to install Tensorflow and it comes along with RASA. What i have done already: $ curl -sSL…
Claudiu Remenyi
  • 75
  • 1
  • 1
  • 6
3
votes
0 answers

Variable type annotations and default initialization to None

I am refactoring a small codebase from Python 2 to 3 (3.4 specifically), and one of the ways I can make the codebase better and more maintainable is by solving all the little PEP based complaints that Pycharm displays. One of the problems is the…
0xCAFEBABE
  • 5,576
  • 5
  • 34
  • 59
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…
ajrlewis
  • 2,968
  • 3
  • 33
  • 67
3
votes
1 answer

What is the Pythonic ordering of function definitions?

Is it this one? def main(): a() def a(): b() def b(): print("foo") if __name__ == "__main__": main() Or this one? def b(): print("foo") def a(): b() def main(): a() if __name__ == "__main__": main() They both…
Deathkamp Drone
  • 282
  • 1
  • 5
  • 11
3
votes
1 answer

What motivates the "no-alignment" policy of PEP 8?

PEP 8 has a specific guideline against whitespace around operators for alignment: No: x = 1 y = 2 long_variable = 3 If I understand correctly, the following is also recommended against: salaries = { "Alice": 1500, …
Alexis
  • 337
  • 1
  • 12
3
votes
2 answers

Unknown variable for Python typehint

I have a wrapper function, what should I put as the return value if the variable to be returned is unknown? def try_catch_in_loop(func_to_call: callable, *args): for attempt in range(NUM_RETRYS + 1): try: if attempt <…
Francisco
  • 2,050
  • 3
  • 14
  • 19
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
  • 275,237
  • 103
  • 548
  • 598
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
  • 763
  • 6
  • 15
3
votes
1 answer

Sort order of relatives imports?

What is the right or PEP way to sort relative imports in python? core/ __init__.py forms.py models.py tests/ __init__.py form_tests/ __init__.py test_xpto.py login.py If I am working…
Aipi
  • 2,076
  • 4
  • 18
  • 27
3
votes
2 answers

Editing PyCharm's Pep8

As most people using PyCharm know, PyCharm has a built-in PEP8 'rule book' that (if you enable it) checks your code, sees if it has any inconsistenties according to those 'rules'. But I noticed something strange, if I go on the python.org website…
GotYa
  • 121
  • 1
  • 8