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.
...Subtraction of datetime Addition Subtraction of timedelta Formatting Parsing Changes to datetime methods Subtraction Addition Strict arithmetics Parsing and formatting Applications Copyright Abstract This PEP specifies a new protocol (PDDM - "A Protocol for Delegating Datetime Methods") that can be used by concrete implementations of the datetime.tzinfo interface to override aware datetime arithmetics, formatting and parsing. We describe changes to the datetime.datetime class to suppor...
...subtraction, timedelta subtraction, and intra-zone datetime subtraction, which each have the mathematical properties of subtraction separately, but not when combined in a single expression. Aware datetime Equality Comparison The aware datetime comparison operators will work the same as they do now, with results indirectly affected by the value of fold whenever the utcoffset() value of one of the operands depends on it, with one exception. Whenever one or both of the operands in inter-zone co...
...subtraction or modification of the Python lexer is outside the scope of this PEP. Reference Implementation No reference implementation is currently provided. A patch was provided at some point in http://sourceforge.net/tracker/index.php?func=detail&aid=599331&group_id=5470&atid=305470 but that patch is no longer maintained. References [1]The (defunct) Python Compiler-SIG http://www.python.org/sigs/compiler-sig/ [2]Parser Module Documentation http://docs.python.org/library...
PEP 327 -- Decimal Data Type PEP:327 Title:Decimal Data Type Author:Facundo Batista <facundo at taniquetil.com.ar> Status:Final Type:Standards Track Created:17-Oct-2003 Python-Version:2.4 Post-History:30-Nov-2003, 02-Jan-2004, 29-Jan-2004 Contents Abstract Motivation The problem with binary float Why floating point? Why not rational? So, what do we have? General Decimal Arithmetic Specification The Arithmetic Model Numbers Context Default Contexts Exceptional Condition...
PEP 672 -- Unicode-related Security Considerations for Python PEP:672 Title:Unicode-related Security Considerations for Python Author:Petr Viktorin <encukou at gmail.com> Status:Active Type:Informational Created:01-Nov-2021 Post-History:01-Nov-2021 Contents Abstract Introduction Acknowledgement Confusing Features ASCII-only Considerations Confusables and Typos Control Characters Confusable Characters in Identifiers Confusable Digits Bidirectional Text Bidirectional Mar...
PEP 290 -- Code Migration and Modernization PEP:290 Title:Code Migration and Modernization Author:Raymond Hettinger <python at rcn.com> Status:Active Type:Informational Created:06-Jun-2002 Post-History: Contents Abstract Rationale Guidelines for New Entries Migration Issues Comparison Operators Not a Shortcut for Producing 0 or 1 Modernization Procedures Python 2.4 or Later Inserting and Popping at the Beginning of Lists Simplifying Custom Sorts Replacing Common Uses of...
...subtraction and coercion to float: class timespec(tuple): def __new__(cls, sec, nsec): if not isinstance(sec, int): raise TypeError if not isinstance(nsec, int): raise TypeError asec, nsec = divmod(nsec, 10 ** 9) sec += asec obj = tuple.__new__(cls, (sec, nsec)) obj.sec = sec obj.nsec = nsec return obj def __float__(self): return self.sec + self.nsec * 1e-9 def total_nanoseconds(self): ...
PEP 209 -- Multi-dimensional Arrays PEP:209 Title:Multi-dimensional Arrays Author:barrett at stsci.edu (Paul Barrett), oliphant at ee.byu.edu (Travis Oliphant) Status:Withdrawn Type:Standards Track Created:03-Jan-2001 Python-Version:2.2 Post-History: Contents Abstract Motivation Proposal Design and Implementation Open Issues Implementation Steps Incompatibilities Appendices Copyright Related PEPs References Abstract This PEP proposes a redesign and re-implementation of the ...
...subtraction. However, the implementation in the math module is written in C, and thus can not (easily) use python's duck typing. Rather, the values passed into the function will be converted to the float type before the calculation is performed. Passing in types (or values) that cannot be converted to floats will raise an appropriate Exception (TypeError, ValueError, or OverflowError). The code will be tested to accommodate at least some values of these types: Decimal int Fraction complex: For ...
PEP 456 -- Secure and interchangeable hash algorithm PEP:456 Title:Secure and interchangeable hash algorithm Author:Christian Heimes <christian at python.org> BDFL-Delegate:Nick Coghlan Status:Final Type:Standards Track Created:27-Sep-2013 Python-Version:3.4 Post-History:06-Oct-2013, 14-Nov-2013, 20-Nov-2013 Resolution:https://mail.python.org/pipermail/python-dev/2013-November/130400.html Contents Abstract Rationale Requirements for a hash function Current implementati...
PEP 3124 -- Overloading, Generic Functions, Interfaces, and Adaptation PEP:3124 Title:Overloading, Generic Functions, Interfaces, and Adaptation Author:Phillip J. Eby <pje at telecommunity.com> Discussions-To:python-3000 at python.org Status:Deferred Type:Standards Track Requires:3107 3115 3119 Created:28-Apr-2007 Post-History:30-Apr-2007 Replaces:245 246 Contents Deferred Abstract Rationale and Goals User API Overloading/Generic Functions @overload vs. @when Method ...
Python Humor Here is a spurious collection of semi to totally unserious stuff, mostly postings found wafting gently in the comp.lang.python newsgroup (a.k.a. the python-list mailing list). See also Andrew Kuchling's collection of Python quotations, containing in a condensed form some sterling examples of the wit and wisdom encountered in the Python world. Contents The Zen of Python Fundamental... Cute Wabbit Shooting Yourself in the Foot Legal Issues Python vs Tcl vs Perl5 Python Object Orie...
PEP 368 -- Standard image protocol and class PEP:368 Title:Standard image protocol and class Author:Lino Mastrodomenico <l.mastrodomenico at gmail.com> Status:Deferred Type:Standards Track Created:28-Jun-2007 Python-Version:2.6, 3.0 Post-History: Contents Abstract PEP Deferral Rationale Specification Python API Mode Objects Image Protocol Image and ImageMixin Classes Line Objects Pixel Objects ImageSize Class C API Examples Backwards Compatibility Reference Implement...
PEP 580 -- The C call protocol PEP:580 Title:The C call protocol Author:Jeroen Demeyer <J.Demeyer at UGent.be> BDFL-Delegate:Petr Viktorin Status:Rejected Type:Standards Track Created:14-Jun-2018 Python-Version:3.8 Post-History:20-Jun-2018, 22-Jun-2018, 16-Jul-2018 Contents Rejection Notice Abstract Motivation Overview New data structures Parent Using tp_print The C call protocol Checking __objclass__ Self slicing Descriptor behavior The __name__ attribute Generic API...
...subtraction PEP 584: Add + and += operators to the built-in dict class. Moving PEP 584 forward (dict + and += operators) PEP 584: Add Union Operators To dict Accepting PEP 584: Add Union Operators To dict Ticket on the bug tracker Merging two dictionaries in an expression is a frequently requested feature. For example: https://stackoverflow.com/questions/38987/how-to-merge-two-dictionaries-in-a-single-expression https://stackoverflow.com/questions/1781571/how-to-concatenate-two-dictionaries-to...
PEP 8 -- Style Guide for Python Code PEP:8 Title:Style Guide for Python Code Author:Guido van Rossum <guido at python.org>, Barry Warsaw <barry at python.org>, Nick Coghlan <ncoghlan at gmail.com> Status:Active Type:Process Created:05-Jul-2001 Post-History:05-Jul-2001, 01-Aug-2013 Contents Introduction A Foolish Consistency is the Hobgoblin of Little Minds Code Lay-out Indentation Tabs or Spaces? Maximum Line Length Should a Line Break Before or After a Binary...
...subtraction *, @, /, //, % Multiplication, matrix multiplication, division, remainder +x, -x, ~x Positive, negative, bitwise NOT ** Exponentiation await x Await expression x[index], x[index:index], x(arguments...), x.attribute Subscription, slicing, call, attribute reference (expressions...), [expressions...], {key: value...}, {expressions...} Binding or tuple display, list display, dictionary display, set display Examples of "await" expressions Valid syntax examples: Expression...
...subtraction operations on constants, so proposals like PEP 634 have to do work in later compilation steps to check for correct usage. Appendix D: History of changes to this proposal The first published iteration of this proposal mostly followed PEP 634, but suggested using ?EXPR for equality constraints and ?is EXPR for identity constraints rather than PEP 634's value patterns and literal patterns. The second published iteration mostly adopted a counter-proposal from Steven D'Aprano that kept ...