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.
...set if it is present, or do nothing if it is not. S.pop() Remove and return an arbitrary element, raising a LookupError if the element is not present. S.clear() Remove all elements from this set. S.copy() Make a new set. s.issuperset() Check for a superset relationship. s.issubset() Check for a subset relationship. and two new built-in conversion functions: set(x) Create a set containing the elements of the collection "x". frozenset(x) Create an immutable set containing the elemen...
...sets; this can be done by exploiting # the above primitive operations: # # <, <=, ==, !=, >=, > (returning a bool) # &, |, ^, - (returning a new, real set object) # # as well as their method counterparts (.union(), etc.). # # To specify the semantics, we can specify x == y as: # # set(x) == set(y) if both x and y are d_keys instances # set(x) == y if x is a d_keys instance # x == set(y) if y is a d_keys ins...
...setting which is not already set will be populated appropriately in the supplied configuration struct. The default configuration can be overridden entirely by setting the value before calling Py_BuildPythonConfig. The provided value will then also be used in calculating any other settings derived from that value. Alternatively, settings may be overridden after the Py_BuildPythonConfig call (this can be useful if an embedding application wants to adjust a setting rather than replace it completely...
...setting LANG for UTF-8 locale coercion Earlier versions of this PEP proposed setting the LANG category independent default locale, in addition to setting LC_CTYPE. This was later removed on the grounds that setting only LC_CTYPE is sufficient to handle all of the problematic scenarios that the PEP aimed to resolve, while setting LANG as well would break cases where LANG was set correctly, and the locale problems were solely due to an incorrect LC_CTYPE setting ([22]). For example, consider a Pyt...
...Sets These abstract classes represent read-only sets and mutable sets. The most fundamental set operation is the membership test, written as x in s and implemented by s.__contains__(x). This operation is already defined by the Container class defined above. Therefore, we define a set as a sized, iterable container for which certain invariants from mathematical set theory hold. The built-in type set derives from MutableSet. The built-in type frozenset derives from Set and Hashable. Set This ...
...set and get using ordinary attribute set and get syntax. Methods also gain getter syntax, and they currently access the attribute through the dictionary of the underlying function object. It is not possible to set attributes on bound or unbound methods, except by doing so explicitly on the underlying function object. See the Future Directions discussion below for approaches in subsequent versions of Python. A function object's __dict__ can also be set, but only to a dictionary object. Deletin...
...set FD_CLOEXEC if APR_FOPEN_NOCLEANUP is not set (fixed in 2009) PHP: system() (and similar) don't cleanup opened handles of Apache (not fixed in January 2013) Atomicity Using fcntl() to set the close-on-exec flag is not safe in a multithreaded application. If a thread calls fork() and exec() between the creation of the file descriptor and the call to fcntl(fd, F_SETFD, new_flags): the file descriptor will be inherited by the child process. Modern operating systems offer functions to set th...
...set values? If __definition_order__ is manually set in the class body then it will be used. We require it to be a tuple of identifiers (or None) so that consumers of __definition_order__ may have a consistent expectation for the value. That helps maximize the feature's usefulness. We could also allow an arbitrary iterable for a manually set __definition_order__ and convert it into a tuple. However, not all iterables infer a definition order (e.g. set). So we opt in favor of requiring a tuple...
...set proceeds by checking the "I_have_computed_attributes" flag. If it is not set, everything proceeds as it does today. If it is set then we must do a dictionary get on the requested object name. If it returns an attribute access handler then we call the setter function with the value. If it returns any other object then we discard the result and continue as we do today. Note that having an attribute access handler will mildly affect attribute "setting" performance for all sets on a particular i...
...set the ssl._create_default_https_context function to be an alias for ssl._create_unverified_context if this environment variable is present and set to '0' otherwise, set the ssl._create_default_https_context function to be an alias for ssl.create_default_context as usual Example implementation _https_verify_envvar = 'PYTHONHTTPSVERIFY' def _get_https_context_factory(): if not sys.flags.ignore_environment: config_setting = os.environ.get(_https_verify_envvar) if config_s...
...settrace, sys.setprofile and PEP 523 frame evaluation. If PEP 523 is in use, or sys.settrace or sys.setprofile has been set, then calling sys.monitoring.set_events() or sys.monitoring.set_local_events() will raise an exception. Likewise, if sys.monitoring.set_events() or sys.monitoring.set_local_events() has been called, then using PEP 523 or calling sys.settrace or sys.setprofile will raise an exception. This PEP is incompatible with sys.settrace and sys.setprofile because the implementation of...
...set automatically to None. When the import system encounters an explicit relative import in a module without __package__ set (or with it set to None), it will calculate and store the correct value (__name__.rpartition('.')[0] for normal modules and __name__ for package initialisation modules). If __package__ has already been set then the import system will use it in preference to recalculating the package name from the __name__ and __path__ attributes. The runpy module will explicitly set the ne...
...set to the root directory (either / on Unix and Mac OSX or the root directory of the startup (installation???) drive -- typically C:\ -- on Windows). If defined and it refers to an existing directory to which the user has write permission, sys.bytecodebase is set to that directory and bytecode files are written into a directory structure rooted at that location. If defined but empty, sys.bytecodebase is set to None and generation of bytecode files is suppressed altogether. If defined and one ...
Version: None
Released: Nov. 3, 2020
This is an early developer preview of Python 3.10 Major new features of the 3.10 series, compared to 3.9 Python 3.10 is still in development. This releasee, 3.10.0a2 is the second of six planned alpha releases. Alpha releases are intended to make it easier to test the current state of …
...set. Otherwise the fallback semantics of setting __name__ to "__main__" will occur. sys.main will still be set to the proper value, regardless of what __name__ is set to. Implementation When the -m option is used, sys.main will be set to the argument passed in. sys.argv will be adjusted as it is currently. Then the equivalent of __import__(self.main) will occur. This differs from current semantics as the runpy module fetches the code object for the file specified by the module name in orde...
...set(value) -> Token is used to set a new value for the context variable in the current Context: # Set the variable 'var' to 1 in the current context. var.set(1) ContextVar.reset(token) is used to reset the variable in the current context to the value it had before the set() operation that created the token (or to remove the variable if it was not set): # Assume: var.get(None) is None # Set 'var' to 1: token = var.set(1) try: # var.get() == 1 finally: var.reset(token) # After rese...
...set are closed in the child process. The flag can be set in two syscalls (one to get current flags, a second to set new flags) using fcntl(): int flags, res; flags = fcntl(fd, F_GETFD); if (flags == -1) { /* handle the error */ } flags |= FD_CLOEXEC; /* or "flags &= ~FD_CLOEXEC;" to clear the flag */ res = fcntl(fd, F_SETFD, flags); if (res == -1) { /* handle the error */ } FreeBSD, Linux, Mac OS X, NetBSD, OpenBSD and QNX also support setting the flag in a single syscall using ioctl(): i...
...sets.Set objects expose a "protocol for automatic conversion to immutable" so that you can create sets.Sets of sets.Sets. PEP 218 deliberately dropped this feature from built-in sets. This PEP advances that the feature is still useful and proposes a standard mechanism for its support. Proposal It is proposed that a new built-in function called freeze() is added. If freeze() is passed an immutable object, as determined by hash() on that object not raising a TypeError, then the object is retur...
...set to Ellipsis. Using Ellipsis by default for __cause__ makes it asymmetrical with __context__. Proposal A new attribute on BaseException, __suppress_context__, will be introduced. Whenever __cause__ is set, __suppress_context__ will be set to True. In particular, raise exc from cause syntax will set exc.__suppress_context__ to True. Exception printing code will check for that attribute to determine whether context and cause will be printed. __cause__ will return to its original purpose and v...
...settings for test runners Recommended filter settings for interactive shells Other documentation updates Reference Implementation Motivation Limitations on PEP Scope References Copyright Abstract In Python 2.7 and Python 3.2, the default warning filters were updated to hide DeprecationWarning by default, such that deprecation warnings in development tools that were themselves written in Python (e.g. linters, static analysers, test runners, code generators), as well as any other applications...