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.
...string, this value is updated to reflect the modified feedback text. It is read-only, and cannot be assigned a new value. Cipher objects require the following methods: decrypt(string) Decrypts 'string', using the key-dependent data in the object and with the appropriate feedback mode. The string's length must be an exact multiple of the algorithm's block size or, in CFB mode, of the segment size. Returns a string containing the plaintext. encrypt(string) Encrypts a non-empty string, using ...
...Strings and bytes Python 2's basic original strings are called 8-bit strings, and they play a dual role in Python 2 as both ASCII text and as byte sequences. While Python 2 also has a unicode string type, the fundamental ambiguity of the core string type, coupled with Python 2's default behavior of supporting automatic coercion from 8-bit strings to unicode objects when the two are combined, often leads to UnicodeErrors. Python 3's standard string type is Unicode based, and Python 3 adds a dedi...
...strings and Unicode strings. It must pass the regression test used for the pcre-based version of the re module. The curses module was in the middle of a transformation to a package, so the final form was adopted. Mechanism The release will be created as a branch from the development tree rooted at CNRI's close of business on 16 May 2000. Patches required from more recent checkins will be merged in by moving the branch tag on individual files whenever possible in order to reduce mailing list ...
...strings-or-a-table-in-toml/5243/38 Contents Abstract Entries Specification dependencies optional-dependencies Example Implementation Parsing Metadata Copyright Abstract This PEP specifies how to write a project's dependencies in a pyproject.toml file for packaging-related tools to consume using the fields defined in PEP 621. Note This PEP has been accepted and is expected to be merged into PEP 621. Entries All dependency entries MUST be valid PEP 508 strings. Build backends SHOU...
...string? (Python, post-regex) (Iron)Python formatting issue with modulo operator & "negative zero" (Python, pre-round) Negative sign in case of zero in java (Java, post-regex) Prevent small negative numbers printing as "-0" (Objective-C, custom number formatter) What we would like instead is a first-class option to normalize negative zero, on top of everything else that numerical string formatting already offers. Rationale There are use cases where negative zero is unwanted in formatted nu...
...string A terminal \ within a single-quoted string, at the end of the line. This is arguably a special case of the terminal \, but it is a special case that may be worth keeping. >>> "abd\ def" 'abd def' Pro: Many of the objections to removing \ termination were really just objections to removing it within literal strings; several people clarified that they want to keep this literal-string usage, but don't mind losing the general case. Pro: The use of \ for an escape character withi...
...strings for debugging or for logging. Although all non-ASCII characters are escaped, this does not matter when most of the string's characters are ASCII. But for other languages, such as Japanese where most characters in a string are not ASCII, this is very inconvenient. We can use print(aJapaneseString) to get a readable string, but we don't have a similar workaround for printing strings from collections such as lists or tuples. print(listOfJapaneseStrings) uses repr() to build the string to...
...strings use the same rules as normal strings, raw strings, binary strings, and triple quoted strings. That is, the string must end with the same character that it started with: if it starts with a single quote it must end with a single quote, etc. This implies that any code that currently scans Python code looking for strings should be trivially modifiable to recognize f-strings (parsing within an f-string is another matter, of course). Once tokenized, f-strings are parsed in to literal strings ...
...string, \xij expands to the character chr(int(ij, 16)) Note that this is the same as in 1.6 and before. In a Unicode string, \xij acts the same as \u00ij i.e. it expands to the obvious Latin-1 character from the initial segment of the Unicode space. An \x not followed by at least two hex digits is a compile-time error, specifically ValueError in 8-bit strings, and UnicodeError (a subclass of ValueError) in Unicode strings. Note that if an \x is followed by more than two hex digits, only...
...String_ for string functions. Public functions and variables use MixedCase with underscores, like this: PyObject_GetAttr, Py_BuildValue, PyExc_TypeError. Occasionally an "internal" function has to be visible to the loader; we use the _Py prefix for this, e.g.: _PyObject_Dump. Macros should have a MixedCase prefix and then use upper case, for example: PyString_AS_STRING, Py_PRINT_RAW. Documentation Strings Use the PyDoc_STR() or PyDoc_STRVAR() macro for docstrings to support building Python w...
...string]) (unkeyed hashes) new(key, [string], [digestmod]) (keyed hashes) Create a new hashing object and return it. The first form is for hashes that are unkeyed, such as MD5 or SHA. For keyed hashes such as HMAC, 'key' is a required parameter containing a string giving the key to use. In both cases, the optional 'string' parameter, if supplied, will be immediately hashed into the object's starting state, as if obj.update(string) was called. After creating a hashing object, arb...
...strings, and the join method: """This string extends across multiple lines, but you may want to use something like Textwrap.dedent to clear out the leading spaces and/or reformat. """ >>> "".join(["empty", "string", "joiner"]) == "emptystringjoiner" True >>> " ".join(["space", "string", "joiner"]) == "space string joiner" >>> "\n".join(["multiple", "lines"]) == "multiple\nlines" == ( """multiple lines""") True Concerns Operator Precedence Guido ...
...string in a similar manner to the representation of Unicode strings. The posix module contains functions that take file or directory names: chdir, listdir, mkdir, open, remove, rename, rmdir, stat, and _getfullpathname. These will use Unicode arguments directly rather than converting them. For the rename function, this behaviour is triggered when either of the arguments is Unicode and the other argument converted to Unicode using the default encoding. The listdir function currently returns a l...
...string containing the literal of the same value. If the argument is not an integer or a rational (see PEP 239) it will passed through the existing built-in "int" to obtain the value. This may cause a loss of information if the object was a float. If the object is a rational, then the result will be formatted as a rational literal (see PEP 240) with the integers in the string being Roman numeral literals. Compatibility Issues No new keywords are introduced by this proposal. Programs that us...
...string literals (both 8-bit and Unicode) are subject to escape sequence expansion while raw string literals only expand a very small subset of escape sequences. Python's tokenizer/compiler combo will need to be updated to work as follows: read the file decode it into Unicode assuming a fixed per-file encoding convert it into a UTF-8 byte string tokenize the UTF-8 content compile it, creating Unicode objects from the given Unicode data and creating string objects from the Unicode literal data b...
...strings, unicode strings, mmap objects, and array objects would expose the locked buffer interface. mmap and array objects would actually enter a locked state while the buffer is active, this is not needed for strings and unicode objects. Resizing locked array objects is not allowed and will raise an exception. Whether closing a locked mmap object is an error or will only be deferred until the lock count reaches zero is an implementation detail. Guido recommends But I'm still very concerned th...
...string : (size:int, perms:int, owner:string, group:string, digest:string)} Dictionary mapping the path of a file installed by this distribution to information about the file. The following fields all come from PEP 241. version : distutils.version.Version Version of this distribution platform : [string] summary : string description : string keywords : string home_page : string author : string author_email : string ...
...template and a formatting operation. Binary formatting features Supported features In this proposal, percent-formatting for bytes and bytearray supports the following features: Looking up formatting arguments by position as well as by name (i.e., %s as well as %(name)s). %s will try to get a Py_buffer on the given value, and fallback on calling __bytes__. The resulting binary data is inserted at the given point in the string. This is expected to work with bytes, bytearray and memoryview ob...
...string ">1.0, !=1.3.4, <2.0" is a legal version declaration. All of the following are possible requirement strings: "rfc822", "zlib (>=1.1.4)", "zope". There's no canonical list of what strings should be used; the Python community is left to choose its own standards. Example: Requires: re Requires: sys Requires: zlib Requires: xml.parsers.expat (>1.0) Requires: psycopg Provides (multiple use) Each entry contains a string describing a package or module that will be provided by thi...
...strings in this application; out of 36,000 strings (with 1,310,000 chars), 35713 where ASCII strings (with 1,300,000 chars). The sources for these strings where not further analysed; many of them likely originate from identifiers in the library, and string constants in Django's source code. In comparison to Python 2, both Unicode and byte strings need to be accounted. In the test application, Unicode and byte strings combined had a length of 2,046,000 units (bytes/chars) in 2.x, and 2,200,000 un...