Notice: While JavaScript is not essential for this website, your interaction with the content will be limited. Please turn JavaScript on for the full experience.
...mine minimum indentation (first line doesn't count): indent = sys.maxint for line in lines[1:]: stripped = line.lstrip() if stripped: indent = min(indent, len(line) - len(stripped)) # Remove indentation (first line is special): trimmed = [lines[0].strip()] if indent < sys.maxint: for line in lines[1:]: trimmed.append(line[indent:].rstrip()) # Strip off trailing and leading blank lines: while trimmed and not trimmed[-1...
...ming up I'd be happy to dive deeper in my reasons for rejecting it there (if there's demand). I do think that (apart from never explaining those dreadful acronyms :-) this was a well-written and well-researched PEP, and I think you've done a great job moderating the discussion, collecting objections, reviewing alternatives, and everything else that is required to turn a heated debate into a PEP. Well done Chris (and everyone who helped), and good luck with your next PEP! """ Abstract Just as P...
...ministrators, tools that repackage the interpreter and some libraries need to customize aspects of the interpreter at startup time. This is usually achieved via sitecustomize.py for system administrators whilst libraries rely on exploiting pth files. This PEP proposes a way of achieving the same functionality in a more user-friendly and structured way. Limitations of pth files If a library needs to perform any customization before an import or that relates to the general working of the interpre...
...minimalist approach that attempts to achieve useful functionality with a minimum of change from the status quo. This PEP instead aims for a more flexible standalone statement design, which requires a larger degree of change to the language. Note that where PEP 403 is better suited to explaining the behaviour of generator expressions correctly, this PEP is better able to explain the behaviour of decorator clauses in general. Both PEPs support adequate explanations for the semantics of container c...
...Min: 0.219186 -> 0.352075: 1.6063x slower Avg: 0.227228 -> 0.364384: 1.6036x slower Significant (t=-51.879098, a=0.95) Stddev: 0.00762 -> 0.02532: 3.3227x larger Timeline: http://tinyurl.com/yfe8z3r ### startup_nosite ### Min: 0.105949 -> 0.264912: 2.5004x slower Avg: 0.107574 -> 0.267505: 2.4867x slower Significant (t=-703.557403, a=0.95) Stddev: 0.00214 -> 0.00240: 1.1209x larger Timeline: http://tinyurl.com/yajn8fa ### bzr_startup ### Min: 0.067990 -> 0.097985: 1.4412x ...
...minimum absolute value of the two. The absolute value of the arithmetic mean of the two These leads to the following possibilities for determining if two values, a and b, are close to each other. abs(a-b) <= tol*abs(a) abs(a-b) <= tol * max( abs(a), abs(b) ) abs(a-b) <= tol * min( abs(a), abs(b) ) abs(a-b) <= tol * (a + b)/2 NOTE: (2) and (3) can also be written as: (abs(a-b) <= abs(tol*a)) or (abs(a-b) <= abs(tol*b)) (abs(a-b) <= abs(tol*a)) and (abs(a-b) <= abs(tol*...
...ming interfaces), library authors try to ensure correct and intended usage of an API. Without the ability to specify which parameters are positional-only, library authors must be careful when choosing appropriate parameter names. This care must be taken even for required parameters or when the parameters have no external semantic meaning for callers of the API. In this PEP, we discuss: Python's history and current semantics for positional-only parameters the problems encountered by not having t...
...minor semantic change is that the Full and Empty exceptions raised by non-blocking calls now occur only if the queue truly was full or empty at the instant the queue was checked (of course the Queue may no longer be full or empty by the time a calling thread sees those exceptions, though). Before, the exceptions could also be raised if it was "merely inconvenient" for the implementation to determine the true state of the Queue (because the Queue was locked by some other method in prog...
...Minds Code Lay-out Indentation Tabs or Spaces? Maximum Line Length Should a Line Break Before or After a Binary Operator? Blank Lines Source File Encoding Imports Module Level Dunder Names String Quotes Whitespace in Expressions and Statements Pet Peeves Other Recommendations When to Use Trailing Commas Comments Block Comments Inline Comments Documentation Strings Naming Conventions Overriding Principle Descriptive: Naming Styles Prescriptive: Naming Conventions Names to Avoid ASCII Compat...
...ming in Python and make it as close to synchronous programming as possible. This PEP assumes that the asynchronous tasks are scheduled and coordinated by an Event Loop similar to that of stdlib module asyncio.events.AbstractEventLoop. While the PEP is not tied to any specific Event Loop implementation, it is relevant only to the kind of coroutine that uses yield as a signal to the scheduler, indicating that the coroutine will be waiting until an event (such as IO) is completed. We believe that ...