On this page
inspect.BufferFlags
Prev: inspect.BoundArguments | Up: inspect | Next: inspect.ClassFoundException
Rel: inspect.ArgInfo, inspect.Arguments, inspect.Attribute, inspect.BlockFinder
Ref: docs.python.org — inspect.BufferFlags
Tags: #public #python3 #stdlib #inspect
Import
import inspect
from inspect import BufferFlags
Signature & Overview
inspect.BufferFlags(*values)
inspect.BufferFlags class.
Methods & Attributes
BufferFlags.as_integer_ratio(self, /)— Return a pair of integers, whose ratio is equal to the original int.BufferFlags.bit_count(self, /)— Number of ones in the binary representation of the absolute value of self.BufferFlags.bit_length(self, /)— Number of bits necessary to represent self in binary.BufferFlags.conjugate(self, /)— Returns self, the complex conjugate of any int.BufferFlags.from_bytes(bytes, byteorder='big', *, signed=False)— Return the integer represented by the given array of bytes.BufferFlags.is_integer(self, /)— Returns True. Exists for duck type compatibility with float.is_integer.BufferFlags.to_bytes(self, /, length=1, byteorder='big', *, signed=False)— Return an array of bytes representing an integer.
Usage
import inspect
# Python 3.12+ IntFlag representing C buffer protocol flags (SIMPLE, WRITABLE, etc.)
assert hasattr(inspect, "BufferFlags")
Gotchas
- Requires Python 3.12+: Used when implementing
__buffer__(self, flags)in pure Python (PEP 688).
REPL Inspect
from inspect import BufferFlags
help(BufferFlags)
Linked from
Related notes
- tuts/python3/stdlib_module/inspect/BoundArguments Linked here; links to this page; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/ClassFoundException Linked here; links to this page; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/inspect/ArgInfo Linked here; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/Arguments Linked here; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/Attribute Linked here; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/BlockFinder Linked here; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/classify_class_attrs shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/cleandoc shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/ClosureVars shared tags: #inspect, #stdlib