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
0
votes
1 answer

PEP TryIt not showing policy WSO2IS

If I am going to do a policy "try" within the pap the result on a request is correct. After publishing the policy to a PDP the same request within the PEP Try it tool does not show any result. Is the PEP Tryit working correctly? Greetings
PKAP
  • 705
  • 8
  • 20
0
votes
1 answer

Virtualenv or PEP370

I have been recommended to follow PEP370 instead of creating virtualenvs. http://legacy.python.org/dev/peps/pep-0370/ Can anyone explain which is a better solution? It seems virtualenvs are redundant since python 2.6.
Jimmy
  • 12,087
  • 28
  • 102
  • 192
0
votes
3 answers

SOAP Header Errors in JAVA Web Service

I'm new for Web Service Development, I'm trying to implement the JAVA web service using XACML approach. I've implemented 2 very simple web services which contain one method that return a String and also the PEP who will filter all requests to my web…
N87UW
  • 21
  • 4
0
votes
1 answer

SublimeLinter User Config parse error (pep8)

I've just installed SublimeLinter to help me manage my Python code. Currently it is flagging up blank lines as errors which is annoying so I wanted to disable that by writing some ignore settings in the user config file. The config file is located…
UniProg
  • 1
  • 1
0
votes
1 answer

Pythonic way of maintaining counter variables?

I have this kind of code: count = 0 for line in lines: #do something with line #do something more with line #finish doing that thing with line count = count + 1 if count % 10000 == 0: print count Is this the right way…
ComputerFellow
  • 11,710
  • 12
  • 50
  • 61
0
votes
2 answers

Pythonic way of doing this?

I have this code construct: flag = True while flag: do_something() if some_condition: flag = False Is it the best way to do that? Or is there a better pythonic way?
ComputerFellow
  • 11,710
  • 12
  • 50
  • 61
0
votes
1 answer

Why does importing from a module from the current directory only work when within that directory?

Background I have a Python project with this directory structure: py/: db/ __init__.py run.py py/db: handle.py __init__.py util.py The files are simple enough that I'm not sure I need to post them; nevertheless: py/run.py from db.handle import…
John Bensin
  • 301
  • 2
  • 5
  • 20
0
votes
2 answers

How to document a returned list in Python

I have a piece of code that scrapes a college timetable webpage and generates a list of lists of lists (of lists) like so: [[[[start_time, end_time], [module_code, period_type, {period_number}], [room_code]], {next modules...}],{next_days...}] If I…
stephenfin
  • 1,447
  • 3
  • 20
  • 41
-1
votes
1 answer

good practice regarding declaring variables inside a loop that we know will be run through

Here, PyCharm warns me for using b outside of the while loop because, and I agree, if we don't go through the loop, b will not be defined. What is the best practice here, adding # noqa after b["test"] = 8, declaring b = {} before the while loop…
-1
votes
1 answer

What is PEP-249?

Are PEP-249 "rules" that Python database modules (eg psycopg) should follow? Is PEP-249 not any Python code, class or something that can be "touchable", or something that is already (natively) inside Python itself? Is PEP-249 a basis for the…
user14522494
-1
votes
1 answer

Is chained method (method cascading) encouraged or discouraged by pep?

inspired by this post, I am assuming that PEP8 is discouraging chained method (method cascading). built-ins are the proof. >>> x = list() >>> x.append(1).append(2) Traceback (most recent call last): File "", line 1, in…
user11074017
-1
votes
1 answer

Short-circuiting outcome

I came across the following statements from PEP 532: __else__ is the short-circuiting outcome for if expressions due to the absence of a trailing else clause __then__ is the short-circuiting outcome for else expressions due to the absence of a…
Simplicity
  • 47,404
  • 98
  • 256
  • 385
-2
votes
1 answer

Exit condition block for non-condition, or long block condition?

I always wanted to ask this question. I would like to know what form I should use, and why. What is better: if my_condition: # very long block of code with multiple indention levels OR: if not my_condition: exit # Still here ? # very long…
JPFrancoia
  • 4,866
  • 10
  • 43
  • 73
-2
votes
1 answer

Does PEP 3333 specification preclude Python WSGI Web Servers from having Rewrite Rules?

For the server part of Python's WSGI specification, not the application part, is the server not allowed to rewrite requests? I ask because I can't find any that do. As I understand it Nginx and Apache are generic so they will have a rewrite rule…
johnny
  • 19,272
  • 52
  • 157
  • 259
-2
votes
1 answer

python custom excepions: where?

Where can I write my custom exceptions? Is there a file like execeptions.py in my software, or do I have to write them in the class they are related to? Are there any PEPs about that?
tapioco123
  • 3,235
  • 10
  • 36
  • 42
1 2 3
16
17