chunk_id
stringlengths
36
36
source
stringclasses
35 values
source_url
stringlengths
0
290
upstream_license
stringclasses
1 value
document_id
stringlengths
36
36
chunk_index
int64
0
324k
retrieved_at
stringclasses
2 values
chunker_version
stringclasses
4 values
content_hash
stringlengths
15
64
content
stringlengths
50
44.7k
namespace
stringclasses
9 values
source_name
stringclasses
35 values
raw_text
stringlengths
50
44.7k
cleaned_text
stringlengths
50
44.7k
tags
stringclasses
49 values
collection_name
stringclasses
11 values
98e3a737-66a1-4579-a9b2-2ea197673180
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,784
supabase-export-v2
6891ec902353369a
not supported. It will not raise any errors, but it will produce very strange results at runtime, such as members being equal to each other:: >>> @dataclass # don't do this: it does not make any sense ... class Color(Enum): ... RED = 1 ... BLUE = 2 ... >>> Color.RED is Color.BLUE False >>> Color.RED == Color.BLUE...
trusted_official_docs
CPython Docs
not supported. It will not raise any errors, but it will produce very strange results at runtime, such as members being equal to each other:: >>> @dataclass # don't do this: it does not make any sense ... class Color(Enum): ... RED = 1 ... BLUE = 2 ... >>> Color.RED is Color.BLUE False >>> Color.RED == Color.BLUE...
not supported. It will not raise any errors, but it will produce very strange results at runtime, such as members being equal to each other:: >>> @dataclass # don't do this: it does not make any sense ... class Color(Enum): ... RED = 1 ... BLUE = 2 ... >>> Color.RED is Color.BLUE False >>> Color.RED == Color.BLUE...
python, official-docs, cpython, P0
Local_Trusted_Corpus
9a2ec702-625a-4d9c-be40-d1ef5cb99bbd
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,907
supabase-export-v2
e39376de519ff793
Iterating over a combination of :class:`Flag` members will only return the members that are comprised of a single bit:: >>> class Color(Flag): ... RED = auto() ... GREEN = auto() ... BLUE = auto() ... MAGENTA = RED | BLUE ... YELLOW = RED | GREEN ... CYAN = GREEN | BLUE ... >>> Color(3) # named combination <Col...
trusted_official_docs
CPython Docs
Iterating over a combination of :class:`Flag` members will only return the members that are comprised of a single bit:: >>> class Color(Flag): ... RED = auto() ... GREEN = auto() ... BLUE = auto() ... MAGENTA = RED | BLUE ... YELLOW = RED | GREEN ... CYAN = GREEN | BLUE ... >>> Color(3) # named combination <Col...
Iterating over a combination of :class:`Flag` members will only return the members that are comprised of a single bit:: >>> class Color(Flag): ... RED = auto() ... GREEN = auto() ... BLUE = auto() ... MAGENTA = RED | BLUE ... YELLOW = RED | GREEN ... CYAN = GREEN | BLUE ... >>> Color(3) # named combination <Col...
python, official-docs, cpython, P0
Local_Trusted_Corpus
9ad851e2-7292-4a4a-926d-b89f601c1f2a
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,965
supabase-export-v2
f7f3abc50b59c5ae
Using a string as the value would look like:: >>> class Color(Enum): ... RED = 'stop' ... GREEN = 'go' ... BLUE = 'too fast!' ... >>> Color.GREEN <Color.GREEN: 'go'>
trusted_official_docs
CPython Docs
Using a string as the value would look like:: >>> class Color(Enum): ... RED = 'stop' ... GREEN = 'go' ... BLUE = 'too fast!' ... >>> Color.GREEN <Color.GREEN: 'go'>
Using a string as the value would look like:: >>> class Color(Enum): ... RED = 'stop' ... GREEN = 'go' ... BLUE = 'too fast!' ... >>> Color.GREEN <Color.GREEN: 'go'>
python, official-docs, cpython, P0
Local_Trusted_Corpus
9edfbf6b-3d69-4bfa-b50d-97f213d6b501
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,806
supabase-export-v2
724d13d13c4da2c2
Enum cannot determine what it is, the new Enum members will not be unpicklable; to keep errors closer to the source, pickling will be disabled. The new pickle protocol 4 also, in some circumstances, relies on :attr:`~type.__qualname__` being set to the location where pickle will be able to find the class. For example, ...
trusted_official_docs
CPython Docs
Enum cannot determine what it is, the new Enum members will not be unpicklable; to keep errors closer to the source, pickling will be disabled. The new pickle protocol 4 also, in some circumstances, relies on :attr:`~type.__qualname__` being set to the location where pickle will be able to find the class. For example, ...
Enum cannot determine what it is, the new Enum members will not be unpicklable; to keep errors closer to the source, pickling will be disabled. The new pickle protocol 4 also, in some circumstances, relies on :attr:`~type.__qualname__` being set to the location where pickle will be able to find the class. For example, ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
a4116df7-0556-4d9b-8dc1-4ae6ea7430c4
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,700
supabase-export-v2
31d1d101fc8ea786
1 ... TUESDAY = 2 ... WEDNESDAY = 4 ... THURSDAY = 8 ... FRIDAY = 16 ... SATURDAY = 32 ... SUNDAY = 64 We've changed two things: we're inherited from :class:`Flag`, and the values are all powers of 2.
trusted_official_docs
CPython Docs
1 ... TUESDAY = 2 ... WEDNESDAY = 4 ... THURSDAY = 8 ... FRIDAY = 16 ... SATURDAY = 32 ... SUNDAY = 64 We've changed two things: we're inherited from :class:`Flag`, and the values are all powers of 2.
1 ... TUESDAY = 2 ... WEDNESDAY = 4 ... THURSDAY = 8 ... FRIDAY = 16 ... SATURDAY = 32 ... SUNDAY = 64 We've changed two things: we're inherited from :class:`Flag`, and the values are all powers of 2.
python, official-docs, cpython, P0
Local_Trusted_Corpus
a639e55a-b7fb-45ac-95fd-38e66a71f210
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,761
supabase-export-v2
d52bf38aa3afb150
Enumerations are Python classes, and can have methods and special methods as usual. If we have this enumeration:: >>> class Mood(Enum): ... FUNKY = 1 ... HAPPY = 3 ... ... def describe(self): ... # self is the member here ... return self.name, self.value ... ... def __str__(self): ... return 'my custom str! {0}'...
trusted_official_docs
CPython Docs
Enumerations are Python classes, and can have methods and special methods as usual. If we have this enumeration:: >>> class Mood(Enum): ... FUNKY = 1 ... HAPPY = 3 ... ... def describe(self): ... # self is the member here ... return self.name, self.value ... ... def __str__(self): ... return 'my custom str! {0}'...
Enumerations are Python classes, and can have methods and special methods as usual. If we have this enumeration:: >>> class Mood(Enum): ... FUNKY = 1 ... HAPPY = 3 ... ... def describe(self): ... # self is the member here ... return self.name, self.value ... ... def __str__(self): ... return 'my custom str! {0}'...
python, official-docs, cpython, P0
Local_Trusted_Corpus
a6b30d93-a995-4951-89c5-1797b0be0637
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,992
supabase-export-v2
b94e47447d27d3d8
If :meth:`~object.__new__` or :meth:`~object.__init__` is defined, the value of the enum member will be passed to those methods:: >>> class Planet(Enum): ... MERCURY = (3.303e+23, 2.4397e6) ... VENUS = (4.869e+24, 6.0518e6) ... EARTH = (5.976e+24, 6.37814e6) ... MARS = (6.421e+23, 3.3972e6) ... JUPITER = (1.9e+27,...
trusted_official_docs
CPython Docs
If :meth:`~object.__new__` or :meth:`~object.__init__` is defined, the value of the enum member will be passed to those methods:: >>> class Planet(Enum): ... MERCURY = (3.303e+23, 2.4397e6) ... VENUS = (4.869e+24, 6.0518e6) ... EARTH = (5.976e+24, 6.37814e6) ... MARS = (6.421e+23, 3.3972e6) ... JUPITER = (1.9e+27,...
If :meth:`~object.__new__` or :meth:`~object.__init__` is defined, the value of the enum member will be passed to those methods:: >>> class Planet(Enum): ... MERCURY = (3.303e+23, 2.4397e6) ... VENUS = (4.869e+24, 6.0518e6) ... EARTH = (5.976e+24, 6.37814e6) ... MARS = (6.421e+23, 3.3972e6) ... JUPITER = (1.9e+27,...
python, official-docs, cpython, P0
Local_Trusted_Corpus
a7dc4550-e9aa-480d-8c85-464c181e92c3
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,692
supabase-export-v2
1e7a2e3d2493df29
that ourselves we can add a method to the :class:`!Weekday` enum to extract the day from the :class:`~datetime.date` instance and return the matching enum member:: @classmethod def from_date(cls, date): return cls(date.isoweekday())
trusted_official_docs
CPython Docs
that ourselves we can add a method to the :class:`!Weekday` enum to extract the day from the :class:`~datetime.date` instance and return the matching enum member:: @classmethod def from_date(cls, date): return cls(date.isoweekday())
that ourselves we can add a method to the :class:`!Weekday` enum to extract the day from the :class:`~datetime.date` instance and return the matching enum member:: @classmethod def from_date(cls, date): return cls(date.isoweekday())
python, official-docs, cpython, P0
Local_Trusted_Corpus
a9463bc8-04fd-4407-b1c5-0f7bee4ca39f
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,799
supabase-export-v2
ff37d717b3ac84bf
The semantics of this API resemble :class:`~collections.namedtuple`. The first argument of the call to :class:`Enum` is the name of the enumeration. The second argument is the *source* of enumeration member names. It can be a whitespace-separated string of names, a sequence of names, a sequence of 2-tuples with key/val...
trusted_official_docs
CPython Docs
The semantics of this API resemble :class:`~collections.namedtuple`. The first argument of the call to :class:`Enum` is the name of the enumeration. The second argument is the *source* of enumeration member names. It can be a whitespace-separated string of names, a sequence of names, a sequence of 2-tuples with key/val...
The semantics of this API resemble :class:`~collections.namedtuple`. The first argument of the call to :class:`Enum` is the name of the enumeration. The second argument is the *source* of enumeration member names. It can be a whitespace-separated string of names, a sequence of names, a sequence of 2-tuples with key/val...
python, official-docs, cpython, P0
Local_Trusted_Corpus
a9640e3b-b990-4997-b374-01525f09efd8
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,960
supabase-export-v2
703476b689964889
Using :class:`object` would look like:: >>> class Color(Enum): ... RED = object() ... GREEN = object() ... BLUE = object() ... >>> Color.GREEN # doctest: +SKIP <Color.GREEN: <object object at 0x...>>
trusted_official_docs
CPython Docs
Using :class:`object` would look like:: >>> class Color(Enum): ... RED = object() ... GREEN = object() ... BLUE = object() ... >>> Color.GREEN # doctest: +SKIP <Color.GREEN: <object object at 0x...>>
Using :class:`object` would look like:: >>> class Color(Enum): ... RED = object() ... GREEN = object() ... BLUE = object() ... >>> Color.GREEN # doctest: +SKIP <Color.GREEN: <object object at 0x...>>
python, official-docs, cpython, P0
Local_Trusted_Corpus
a9b95ec1-c794-40c4-af4c-acc7ab80f5c0
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,716
supabase-export-v2
716a38f000839e6b
access members in enumerations programmatically (i.e. situations where ``Color.RED`` won't do because the exact color is not known at program-writing time). ``Enum`` allows such access:: >>> Color(1) <Color.RED: 1> >>> Color(3) <Color.BLUE: 3>
trusted_official_docs
CPython Docs
access members in enumerations programmatically (i.e. situations where ``Color.RED`` won't do because the exact color is not known at program-writing time). ``Enum`` allows such access:: >>> Color(1) <Color.RED: 1> >>> Color(3) <Color.BLUE: 3>
access members in enumerations programmatically (i.e. situations where ``Color.RED`` won't do because the exact color is not known at program-writing time). ``Enum`` allows such access:: >>> Color(1) <Color.RED: 1> >>> Color(3) <Color.BLUE: 3>
python, official-docs, cpython, P0
Local_Trusted_Corpus
ac0ffb29-beaa-4a7b-b7f2-70d0d9ec8029
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,694
supabase-export-v2
236c2f956ba7f897
The complete :class:`!Weekday` enum now looks like this:: >>> class Weekday(Enum): ... MONDAY = 1 ... TUESDAY = 2 ... WEDNESDAY = 3 ... THURSDAY = 4 ... FRIDAY = 5 ... SATURDAY = 6 ... SUNDAY = 7 ... # ... @classmethod ... def from_date(cls, date): ... return cls(date.isoweekday())
trusted_official_docs
CPython Docs
The complete :class:`!Weekday` enum now looks like this:: >>> class Weekday(Enum): ... MONDAY = 1 ... TUESDAY = 2 ... WEDNESDAY = 3 ... THURSDAY = 4 ... FRIDAY = 5 ... SATURDAY = 6 ... SUNDAY = 7 ... # ... @classmethod ... def from_date(cls, date): ... return cls(date.isoweekday())
The complete :class:`!Weekday` enum now looks like this:: >>> class Weekday(Enum): ... MONDAY = 1 ... TUESDAY = 2 ... WEDNESDAY = 3 ... THURSDAY = 4 ... FRIDAY = 5 ... SATURDAY = 6 ... SUNDAY = 7 ... # ... @classmethod ... def from_date(cls, date): ... return cls(date.isoweekday())
python, official-docs, cpython, P0
Local_Trusted_Corpus
adc90107-c1bc-4ec6-bfc7-66d8899e8ba8
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,953
supabase-export-v2
370d2a870b0fe82b
In many use-cases, one doesn't care what the actual value of an enumeration is. There are several ways to define this type of simple enumeration: - use instances of :class:`auto` for the value - use instances of :class:`object` as the value - use a descriptive string as the value - use a tuple as the value and a custom...
trusted_official_docs
CPython Docs
In many use-cases, one doesn't care what the actual value of an enumeration is. There are several ways to define this type of simple enumeration: - use instances of :class:`auto` for the value - use instances of :class:`object` as the value - use a descriptive string as the value - use a tuple as the value and a custom...
In many use-cases, one doesn't care what the actual value of an enumeration is. There are several ways to define this type of simple enumeration: - use instances of :class:`auto` for the value - use instances of :class:`object` as the value - use a descriptive string as the value - use a tuple as the value and a custom...
python, official-docs, cpython, P0
Local_Trusted_Corpus
ade31dbb-8334-44f9-886a-4cc870a979f3
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,849
supabase-export-v2
7c97c0fbf16d3191
>>> Perm.R & Perm.X <Perm: 0> >>> bool(Perm.R & Perm.X) False Because :class:`IntFlag` members are also subclasses of :class:`int` they can be combined with them (but may lose :class:`IntFlag` membership::
trusted_official_docs
CPython Docs
>>> Perm.R & Perm.X <Perm: 0> >>> bool(Perm.R & Perm.X) False Because :class:`IntFlag` members are also subclasses of :class:`int` they can be combined with them (but may lose :class:`IntFlag` membership::
>>> Perm.R & Perm.X <Perm: 0> >>> bool(Perm.R & Perm.X) False Because :class:`IntFlag` members are also subclasses of :class:`int` they can be combined with them (but may lose :class:`IntFlag` membership::
python, official-docs, cpython, P0
Local_Trusted_Corpus
aec05442-8a26-4220-a807-a6b5f612f873
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,681
supabase-export-v2
61ac6e01fc000ce3
name clashes between mixin-class methods/attributes and enum names, we strongly recommend using UPPER_CASE names for members, and will be using that style in our examples. Depending on the nature of the enum a member's value may or may not be important, but either way that value can be used to get the corresponding mem...
trusted_official_docs
CPython Docs
name clashes between mixin-class methods/attributes and enum names, we strongly recommend using UPPER_CASE names for members, and will be using that style in our examples. Depending on the nature of the enum a member's value may or may not be important, but either way that value can be used to get the corresponding mem...
name clashes between mixin-class methods/attributes and enum names, we strongly recommend using UPPER_CASE names for members, and will be using that style in our examples. Depending on the nature of the enum a member's value may or may not be important, but either way that value can be used to get the corresponding mem...
python, official-docs, cpython, P0
Local_Trusted_Corpus
b01c14fe-eeef-4534-9b61-f871d26d33c5
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,812
supabase-export-v2
835e953c7ce009d2
* *names*: The enum members. This can be a whitespace- or comma-separated string (values will start at 1 unless otherwise specified):: 'RED GREEN BLUE' | 'RED,GREEN,BLUE' | 'RED, GREEN, BLUE'
trusted_official_docs
CPython Docs
* *names*: The enum members. This can be a whitespace- or comma-separated string (values will start at 1 unless otherwise specified):: 'RED GREEN BLUE' | 'RED,GREEN,BLUE' | 'RED, GREEN, BLUE'
* *names*: The enum members. This can be a whitespace- or comma-separated string (values will start at 1 unless otherwise specified):: 'RED GREEN BLUE' | 'RED,GREEN,BLUE' | 'RED, GREEN, BLUE'
python, official-docs, cpython, P0
Local_Trusted_Corpus
b0d34619-b05d-4e21-a7a3-0e0a0b6d493c
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,698
supabase-export-v2
b76cf2428e1454c6
Of course, if you're reading this on some other day, you'll see that day instead. This :class:`!Weekday` enum is great if our variable only needs one day, but what if we need several? Maybe we're writing a function to plot chores during a week, and don't want to use a :class:`list` -- we could use a different type of :...
trusted_official_docs
CPython Docs
Of course, if you're reading this on some other day, you'll see that day instead. This :class:`!Weekday` enum is great if our variable only needs one day, but what if we need several? Maybe we're writing a function to plot chores during a week, and don't want to use a :class:`list` -- we could use a different type of :...
Of course, if you're reading this on some other day, you'll see that day instead. This :class:`!Weekday` enum is great if our variable only needs one day, but what if we need several? Maybe we're writing a function to plot chores during a week, and don't want to use a :class:`list` -- we could use a different type of :...
python, official-docs, cpython, P0
Local_Trusted_Corpus
b159eea7-212b-45d0-af11-39c1076409db
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,735
supabase-export-v2
b6ea731127a57310
The values are chosen by :func:`~Enum._generate_next_value_`, which can be overridden:: >>> class AutoName(Enum): ... @staticmethod ... def _generate_next_value_(name, start, count, last_values): ... return name ... >>> class Ordinal(AutoName): ... NORTH = auto() ... SOUTH = auto() ... EAST = auto() ... WEST = ...
trusted_official_docs
CPython Docs
The values are chosen by :func:`~Enum._generate_next_value_`, which can be overridden:: >>> class AutoName(Enum): ... @staticmethod ... def _generate_next_value_(name, start, count, last_values): ... return name ... >>> class Ordinal(AutoName): ... NORTH = auto() ... SOUTH = auto() ... EAST = auto() ... WEST = ...
The values are chosen by :func:`~Enum._generate_next_value_`, which can be overridden:: >>> class AutoName(Enum): ... @staticmethod ... def _generate_next_value_(name, start, count, last_values): ... return name ... >>> class Ordinal(AutoName): ... NORTH = auto() ... SOUTH = auto() ... EAST = auto() ... WEST = ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
b18c830a-1581-4729-862b-7ceb7b60add1
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,893
supabase-export-v2
09e05d2a3aaf0291
``Enum`` member type ^^^^^^^^^^^^^^^^^^^^ Enum members are instances of their enum class, and are normally accessed as ``EnumClass.member``. In certain situations, such as writing custom enum behavior, being able to access one member directly from another is useful, and is supported; however, in order to avoid name cla...
trusted_official_docs
CPython Docs
``Enum`` member type ^^^^^^^^^^^^^^^^^^^^ Enum members are instances of their enum class, and are normally accessed as ``EnumClass.member``. In certain situations, such as writing custom enum behavior, being able to access one member directly from another is useful, and is supported; however, in order to avoid name cla...
``Enum`` member type ^^^^^^^^^^^^^^^^^^^^ Enum members are instances of their enum class, and are normally accessed as ``EnumClass.member``. In certain situations, such as writing custom enum behavior, being able to access one member directly from another is useful, and is supported; however, in order to avoid name cla...
python, official-docs, cpython, P0
Local_Trusted_Corpus
b3e00edd-f44d-4e3d-91ac-376dbddcbc98
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,769
supabase-export-v2
cf70a8385c28256a
Restricted Enum subclassing --------------------------- A new :class:`Enum` class must have one base enum class, up to one concrete data type, and as many :class:`object`-based mixin classes as needed. The order of these base classes is::
trusted_official_docs
CPython Docs
Restricted Enum subclassing --------------------------- A new :class:`Enum` class must have one base enum class, up to one concrete data type, and as many :class:`object`-based mixin classes as needed. The order of these base classes is::
Restricted Enum subclassing --------------------------- A new :class:`Enum` class must have one base enum class, up to one concrete data type, and as many :class:`object`-based mixin classes as needed. The order of these base classes is::
python, official-docs, cpython, P0
Local_Trusted_Corpus
b41a69a7-ce44-4278-90b5-1ff6bf9c6385
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,919
supabase-export-v2
e8c2c8186590422a
>>> (Color.RED | Color.GREEN).name 'RED|GREEN' >>> class Perm(IntFlag): ... R = 4 ... W = 2 ... X = 1 ... >>> (Perm.R & Perm.W).name is None # effectively Perm(0) True
trusted_official_docs
CPython Docs
>>> (Color.RED | Color.GREEN).name 'RED|GREEN' >>> class Perm(IntFlag): ... R = 4 ... W = 2 ... X = 1 ... >>> (Perm.R & Perm.W).name is None # effectively Perm(0) True
>>> (Color.RED | Color.GREEN).name 'RED|GREEN' >>> class Perm(IntFlag): ... R = 4 ... W = 2 ... X = 1 ... >>> (Perm.R & Perm.W).name is None # effectively Perm(0) True
python, official-docs, cpython, P0
Local_Trusted_Corpus
b8c120b5-36b1-46c9-be63-dc0a2c559da1
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,827
supabase-export-v2
17b141c3a363cfb8
of :class:`int`. Members of an :class:`IntEnum` can be compared to integers; by extension, integer enumerations of different types can also be compared to each other:: >>> from enum import IntEnum >>> class Shape(IntEnum): ... CIRCLE = 1 ... SQUARE = 2 ... >>> class Request(IntEnum): ... POST = 1 ... GET = 2 ......
trusted_official_docs
CPython Docs
of :class:`int`. Members of an :class:`IntEnum` can be compared to integers; by extension, integer enumerations of different types can also be compared to each other:: >>> from enum import IntEnum >>> class Shape(IntEnum): ... CIRCLE = 1 ... SQUARE = 2 ... >>> class Request(IntEnum): ... POST = 1 ... GET = 2 ......
of :class:`int`. Members of an :class:`IntEnum` can be compared to integers; by extension, integer enumerations of different types can also be compared to each other:: >>> from enum import IntEnum >>> class Shape(IntEnum): ... CIRCLE = 1 ... SQUARE = 2 ... >>> class Request(IntEnum): ... POST = 1 ... GET = 2 ......
python, official-docs, cpython, P0
Local_Trusted_Corpus
b9103b84-ef4e-404b-a0a0-24797c68d955
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,903
supabase-export-v2
a5fd7f0c54063ff6
``Enum`` classes with methods ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ If you give your enum subclass extra methods, like the `Planet`_ class below, those methods will show up in a :func:`dir` of the member, but not of the class::
trusted_official_docs
CPython Docs
``Enum`` classes with methods ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ If you give your enum subclass extra methods, like the `Planet`_ class below, those methods will show up in a :func:`dir` of the member, but not of the class::
``Enum`` classes with methods ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ If you give your enum subclass extra methods, like the `Planet`_ class below, those methods will show up in a :func:`dir` of the member, but not of the class::
python, official-docs, cpython, P0
Local_Trusted_Corpus
b9de42f5-9588-4650-b97c-cf1109577837
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,962
supabase-export-v2
3da4e4fa0b286534
This is also a good example of why you might want to write your own :meth:`~object.__repr__`:: >>> class Color(Enum): ... RED = object() ... GREEN = object() ... BLUE = object() ... def __repr__(self): ... return "<%s.%s>" % (self.__class__.__name__, self._name_) ... >>> Color.GREEN <Color.GREEN>
trusted_official_docs
CPython Docs
This is also a good example of why you might want to write your own :meth:`~object.__repr__`:: >>> class Color(Enum): ... RED = object() ... GREEN = object() ... BLUE = object() ... def __repr__(self): ... return "<%s.%s>" % (self.__class__.__name__, self._name_) ... >>> Color.GREEN <Color.GREEN>
This is also a good example of why you might want to write your own :meth:`~object.__repr__`:: >>> class Color(Enum): ... RED = object() ... GREEN = object() ... BLUE = object() ... def __repr__(self): ... return "<%s.%s>" % (self.__class__.__name__, self._name_) ... >>> Color.GREEN <Color.GREEN>
python, official-docs, cpython, P0
Local_Trusted_Corpus
bba8086d-ba4a-47f0-aa86-0a1e0e4e0024
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,874
supabase-export-v2
a0c41ade8e0c4b8a
type is mixed in, the :attr:`~Enum.value` attribute is *not the same* as the enum member itself, although it is equivalent and will compare equal. 5. A ``data type`` is a mixin that defines :meth:`~object.__new__`, or a :class:`~dataclasses.dataclass` 6. %-style formatting: ``%s`` and ``%r`` call the :class:`Enum` cla...
trusted_official_docs
CPython Docs
type is mixed in, the :attr:`~Enum.value` attribute is *not the same* as the enum member itself, although it is equivalent and will compare equal. 5. A ``data type`` is a mixin that defines :meth:`~object.__new__`, or a :class:`~dataclasses.dataclass` 6. %-style formatting: ``%s`` and ``%r`` call the :class:`Enum` cla...
type is mixed in, the :attr:`~Enum.value` attribute is *not the same* as the enum member itself, although it is equivalent and will compare equal. 5. A ``data type`` is a mixin that defines :meth:`~object.__new__`, or a :class:`~dataclasses.dataclass` 6. %-style formatting: ``%s`` and ``%r`` call the :class:`Enum` cla...
python, official-docs, cpython, P0
Local_Trusted_Corpus
bcac65cf-fb9f-47c8-a899-2f908d5e1f17
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,751
supabase-export-v2
4a22ad8a6d6a266e
>>> Color.RED is Color.RED True >>> Color.RED is Color.BLUE False >>> Color.RED is not Color.BLUE True Ordered comparisons between enumeration values are *not* supported. Enum members are not integers (but see `IntEnum`_ below)::
trusted_official_docs
CPython Docs
>>> Color.RED is Color.RED True >>> Color.RED is Color.BLUE False >>> Color.RED is not Color.BLUE True Ordered comparisons between enumeration values are *not* supported. Enum members are not integers (but see `IntEnum`_ below)::
>>> Color.RED is Color.RED True >>> Color.RED is Color.BLUE False >>> Color.RED is not Color.BLUE True Ordered comparisons between enumeration values are *not* supported. Enum members are not integers (but see `IntEnum`_ below)::
python, official-docs, cpython, P0
Local_Trusted_Corpus
bd1d199e-6c15-49cd-b60c-88d1322b841c
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,792
supabase-export-v2
807d8afc3bcaa341
members are pickled/unpickled by defining :meth:`~object.__reduce_ex__` in the enumeration class. The default method is by-value, but enums with complicated values may want to use by-name:: >>> import enum >>> class MyEnum(enum.Enum): ... __reduce_ex__ = enum.pickle_by_enum_name
trusted_official_docs
CPython Docs
members are pickled/unpickled by defining :meth:`~object.__reduce_ex__` in the enumeration class. The default method is by-value, but enums with complicated values may want to use by-name:: >>> import enum >>> class MyEnum(enum.Enum): ... __reduce_ex__ = enum.pickle_by_enum_name
members are pickled/unpickled by defining :meth:`~object.__reduce_ex__` in the enumeration class. The default method is by-value, but enums with complicated values may want to use by-name:: >>> import enum >>> class MyEnum(enum.Enum): ... __reduce_ex__ = enum.pickle_by_enum_name
python, official-docs, cpython, P0
Local_Trusted_Corpus
be61f0f6-8dc6-47c5-9c74-bd07110e1d75
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,905
supabase-export-v2
825ec06213b12aca
['EARTH', 'JUPITER', 'MARS', 'MERCURY', 'NEPTUNE', 'SATURN', 'URANUS', 'VENUS', '__class__', '__doc__', '__members__', '__module__'] >>> dir(Planet.EARTH) # doctest: +SKIP ['__class__', '__doc__', '__module__', 'mass', 'name', 'radius', 'surface_gravity', 'value'] Combining members of ``Flag`` ^^^^^^^^^^^^^^^^^^^^^^^^^...
trusted_official_docs
CPython Docs
['EARTH', 'JUPITER', 'MARS', 'MERCURY', 'NEPTUNE', 'SATURN', 'URANUS', 'VENUS', '__class__', '__doc__', '__members__', '__module__'] >>> dir(Planet.EARTH) # doctest: +SKIP ['__class__', '__doc__', '__module__', 'mass', 'name', 'radius', 'surface_gravity', 'value'] Combining members of ``Flag`` ^^^^^^^^^^^^^^^^^^^^^^^^^...
['EARTH', 'JUPITER', 'MARS', 'MERCURY', 'NEPTUNE', 'SATURN', 'URANUS', 'VENUS', '__class__', '__doc__', '__members__', '__module__'] >>> dir(Planet.EARTH) # doctest: +SKIP ['__class__', '__doc__', '__module__', 'mass', 'name', 'radius', 'surface_gravity', 'value'] Combining members of ``Flag`` ^^^^^^^^^^^^^^^^^^^^^^^^^...
python, official-docs, cpython, P0
Local_Trusted_Corpus
c28b6d50-e076-408d-abe5-fd3e96897ecd
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,898
supabase-export-v2
b7b9f0a5ca1ce321
# help(int) -> int(x, base=10) -> integer ... example = '11', 16 # so x='11' and base=16 ... >>> MyEnum.example.value # and hex(11) is... 17 Boolean value of ``Enum`` classes and members ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
trusted_official_docs
CPython Docs
# help(int) -> int(x, base=10) -> integer ... example = '11', 16 # so x='11' and base=16 ... >>> MyEnum.example.value # and hex(11) is... 17 Boolean value of ``Enum`` classes and members ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# help(int) -> int(x, base=10) -> integer ... example = '11', 16 # so x='11' and base=16 ... >>> MyEnum.example.value # and hex(11) is... 17 Boolean value of ``Enum`` classes and members ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
python, official-docs, cpython, P0
Local_Trusted_Corpus
c4e66a89-4681-4b0a-87d7-c2c994e3fb1a
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,971
supabase-export-v2
46ef0d290a966d21
this is the only change from above ... value = len(cls.__members__) + 1 ... obj = object.__new__(cls) ... obj._value_ = value ... return obj ... Then when you inherit from ``AutoNumber`` you can write your own ``__init__`` to handle any extra arguments::
trusted_official_docs
CPython Docs
this is the only change from above ... value = len(cls.__members__) + 1 ... obj = object.__new__(cls) ... obj._value_ = value ... return obj ... Then when you inherit from ``AutoNumber`` you can write your own ``__init__`` to handle any extra arguments::
this is the only change from above ... value = len(cls.__members__) + 1 ... obj = object.__new__(cls) ... obj._value_ = value ... return obj ... Then when you inherit from ``AutoNumber`` you can write your own ``__init__`` to handle any extra arguments::
python, official-docs, cpython, P0
Local_Trusted_Corpus
c79bbb3f-961c-4dcd-bf7d-988c8ed4910e
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,798
supabase-export-v2
dc05f466f6934358
Animal = Enum('Animal', 'ANT BEE CAT DOG') >>> Animal <enum 'Animal'> >>> Animal.ANT <Animal.ANT: 1> >>> list(Animal) [<Animal.ANT: 1>, <Animal.BEE: 2>, <Animal.CAT: 3>, <Animal.DOG: 4>] The semantics of this API resemble :class:`~collections.namedtuple`. The first argument of the call to :class:`Enum` is the name of t...
trusted_official_docs
CPython Docs
Animal = Enum('Animal', 'ANT BEE CAT DOG') >>> Animal <enum 'Animal'> >>> Animal.ANT <Animal.ANT: 1> >>> list(Animal) [<Animal.ANT: 1>, <Animal.BEE: 2>, <Animal.CAT: 3>, <Animal.DOG: 4>] The semantics of this API resemble :class:`~collections.namedtuple`. The first argument of the call to :class:`Enum` is the name of t...
Animal = Enum('Animal', 'ANT BEE CAT DOG') >>> Animal <enum 'Animal'> >>> Animal.ANT <Animal.ANT: 1> >>> list(Animal) [<Animal.ANT: 1>, <Animal.BEE: 2>, <Animal.CAT: 3>, <Animal.DOG: 4>] The semantics of this API resemble :class:`~collections.namedtuple`. The first argument of the call to :class:`Enum` is the name of t...
python, official-docs, cpython, P0
Local_Trusted_Corpus
c9dc803c-aae9-4e1d-8ec0-f5d4d29cbf58
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,968
supabase-export-v2
824d2c6220e6e722
Using an auto-numbering :meth:`~object.__new__` would look like:: >>> class AutoNumber(Enum): ... def __new__(cls): ... value = len(cls.__members__) + 1 ... obj = object.__new__(cls) ... obj._value_ = value ... return obj ... >>> class Color(AutoNumber): ... RED = () ... GREEN = () ... BLUE = () ... >>> Color...
trusted_official_docs
CPython Docs
Using an auto-numbering :meth:`~object.__new__` would look like:: >>> class AutoNumber(Enum): ... def __new__(cls): ... value = len(cls.__members__) + 1 ... obj = object.__new__(cls) ... obj._value_ = value ... return obj ... >>> class Color(AutoNumber): ... RED = () ... GREEN = () ... BLUE = () ... >>> Color...
Using an auto-numbering :meth:`~object.__new__` would look like:: >>> class AutoNumber(Enum): ... def __new__(cls): ... value = len(cls.__members__) + 1 ... obj = object.__new__(cls) ... obj._value_ = value ... return obj ... >>> class Color(AutoNumber): ... RED = () ... GREEN = () ... BLUE = () ... >>> Color...
python, official-docs, cpython, P0
Local_Trusted_Corpus
ca2a7369-94fe-486c-89d8-b623b472dc86
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,937
supabase-export-v2
45127c620ec02bde
Enum Classes ^^^^^^^^^^^^ The :class:`EnumType` metaclass is responsible for providing the :meth:`~object.__contains__`, :meth:`~object.__dir__`, :meth:`~object.__iter__` and other methods that allow one to do things with an :class:`Enum` class that fail on a typical class, such as ``list(Color)`` or ``some_enum_var in...
trusted_official_docs
CPython Docs
Enum Classes ^^^^^^^^^^^^ The :class:`EnumType` metaclass is responsible for providing the :meth:`~object.__contains__`, :meth:`~object.__dir__`, :meth:`~object.__iter__` and other methods that allow one to do things with an :class:`Enum` class that fail on a typical class, such as ``list(Color)`` or ``some_enum_var in...
Enum Classes ^^^^^^^^^^^^ The :class:`EnumType` metaclass is responsible for providing the :meth:`~object.__contains__`, :meth:`~object.__dir__`, :meth:`~object.__iter__` and other methods that allow one to do things with an :class:`Enum` class that fail on a typical class, such as ``list(Color)`` or ``some_enum_var in...
python, official-docs, cpython, P0
Local_Trusted_Corpus
cbe23e3b-b0a8-40ca-b898-92f2a935a109
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,783
supabase-export-v2
b7bf9ae98604fb66
.. note:: Adding :func:`~dataclasses.dataclass` decorator to :class:`Enum` and its subclasses is not supported. It will not raise any errors, but it will produce very strange results at runtime, such as members being equal to each other::
trusted_official_docs
CPython Docs
.. note:: Adding :func:`~dataclasses.dataclass` decorator to :class:`Enum` and its subclasses is not supported. It will not raise any errors, but it will produce very strange results at runtime, such as members being equal to each other::
.. note:: Adding :func:`~dataclasses.dataclass` decorator to :class:`Enum` and its subclasses is not supported. It will not raise any errors, but it will produce very strange results at runtime, such as members being equal to each other::
python, official-docs, cpython, P0
Local_Trusted_Corpus
ce55e74f-734c-4e2d-ae60-7b6b02a80f49
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,879
supabase-export-v2
ea0b1a0da5c7606e
When to use :meth:`~object.__new__` vs. :meth:`~object.__init__` ---------------------------------------------------------------- :meth:`~object.__new__` must be used whenever you want to customize the actual value of the :class:`Enum` member. Any other modifications may go in either :meth:`~object.__new__` or :meth:`~...
trusted_official_docs
CPython Docs
When to use :meth:`~object.__new__` vs. :meth:`~object.__init__` ---------------------------------------------------------------- :meth:`~object.__new__` must be used whenever you want to customize the actual value of the :class:`Enum` member. Any other modifications may go in either :meth:`~object.__new__` or :meth:`~...
When to use :meth:`~object.__new__` vs. :meth:`~object.__init__` ---------------------------------------------------------------- :meth:`~object.__new__` must be used whenever you want to customize the actual value of the :class:`Enum` member. Any other modifications may go in either :meth:`~object.__new__` or :meth:`~...
python, official-docs, cpython, P0
Local_Trusted_Corpus
d7826a7f-00fd-4c7f-89bb-003cd7db2282
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,734
supabase-export-v2
bbbcf6ae22d75bc3
>>> class Color(Enum): ... RED = auto() ... BLUE = auto() ... GREEN = auto() ... >>> [member.value for member in Color] [1, 2, 3] The values are chosen by :func:`~Enum._generate_next_value_`, which can be overridden::
trusted_official_docs
CPython Docs
>>> class Color(Enum): ... RED = auto() ... BLUE = auto() ... GREEN = auto() ... >>> [member.value for member in Color] [1, 2, 3] The values are chosen by :func:`~Enum._generate_next_value_`, which can be overridden::
>>> class Color(Enum): ... RED = auto() ... BLUE = auto() ... GREEN = auto() ... >>> [member.value for member in Color] [1, 2, 3] The values are chosen by :func:`~Enum._generate_next_value_`, which can be overridden::
python, official-docs, cpython, P0
Local_Trusted_Corpus
d8dabc15-3851-4215-ac56-068ac1ff189d
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,758
supabase-export-v2
42f349457e286c56
reload modules -- if a reloaded module contains enums, they will be recreated, and the new members may not compare identical/equal to the original members. Allowed members and attributes of enumerations ----------------------------------------------
trusted_official_docs
CPython Docs
reload modules -- if a reloaded module contains enums, they will be recreated, and the new members may not compare identical/equal to the original members. Allowed members and attributes of enumerations ----------------------------------------------
reload modules -- if a reloaded module contains enums, they will be recreated, and the new members may not compare identical/equal to the original members. Allowed members and attributes of enumerations ----------------------------------------------
python, official-docs, cpython, P0
Local_Trusted_Corpus
d8fd845a-67dd-48e8-948c-e1d813859125
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,908
supabase-export-v2
12148f08fcf208dc
RED | GREEN ... CYAN = GREEN | BLUE ... >>> Color(3) # named combination <Color.YELLOW: 3> >>> Color(7) # not named combination <Color.RED|GREEN|BLUE: 7> ``Flag`` and ``IntFlag`` minutia ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
trusted_official_docs
CPython Docs
RED | GREEN ... CYAN = GREEN | BLUE ... >>> Color(3) # named combination <Color.YELLOW: 3> >>> Color(7) # not named combination <Color.RED|GREEN|BLUE: 7> ``Flag`` and ``IntFlag`` minutia ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RED | GREEN ... CYAN = GREEN | BLUE ... >>> Color(3) # named combination <Color.YELLOW: 3> >>> Color(7) # not named combination <Color.RED|GREEN|BLUE: 7> ``Flag`` and ``IntFlag`` minutia ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
python, official-docs, cpython, P0
Local_Trusted_Corpus
e1f13978-5d25-41ca-a37d-09035414fa7b
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,678
supabase-export-v2
3815f34a75efd27f
>>> from enum import Enum >>> class Color(Enum): ... RED = 1 ... GREEN = 2 ... BLUE = 3 As you can see, creating an :class:`Enum` is as simple as writing a class that inherits from :class:`Enum` itself.
trusted_official_docs
CPython Docs
>>> from enum import Enum >>> class Color(Enum): ... RED = 1 ... GREEN = 2 ... BLUE = 3 As you can see, creating an :class:`Enum` is as simple as writing a class that inherits from :class:`Enum` itself.
>>> from enum import Enum >>> class Color(Enum): ... RED = 1 ... GREEN = 2 ... BLUE = 3 As you can see, creating an :class:`Enum` is as simple as writing a class that inherits from :class:`Enum` itself.
python, official-docs, cpython, P0
Local_Trusted_Corpus
e45f7d34-daed-475e-9061-2a2cb0b2505c
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,725
supabase-export-v2
b80ff0c3f819ef52
``A`` will return the member ``A``. By-name lookup of ``A`` will return the member ``A``. By-name lookup of ``B`` will also return the member ``A``:: >>> class Shape(Enum): ... SQUARE = 2 ... DIAMOND = 1 ... CIRCLE = 3 ... ALIAS_FOR_SQUARE = 2 ... >>> Shape.SQUARE <Shape.SQUARE: 2> >>> Shape.ALIAS_FOR_SQUARE <S...
trusted_official_docs
CPython Docs
``A`` will return the member ``A``. By-name lookup of ``A`` will return the member ``A``. By-name lookup of ``B`` will also return the member ``A``:: >>> class Shape(Enum): ... SQUARE = 2 ... DIAMOND = 1 ... CIRCLE = 3 ... ALIAS_FOR_SQUARE = 2 ... >>> Shape.SQUARE <Shape.SQUARE: 2> >>> Shape.ALIAS_FOR_SQUARE <S...
``A`` will return the member ``A``. By-name lookup of ``A`` will return the member ``A``. By-name lookup of ``B`` will also return the member ``A``:: >>> class Shape(Enum): ... SQUARE = 2 ... DIAMOND = 1 ... CIRCLE = 3 ... ALIAS_FOR_SQUARE = 2 ... >>> Shape.SQUARE <Shape.SQUARE: 2> >>> Shape.ALIAS_FOR_SQUARE <S...
python, official-docs, cpython, P0
Local_Trusted_Corpus
e51e3ada-334f-4e02-a4ef-7707c4d61cf8
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,680
supabase-export-v2
ca18becc05c9ed9a
.. note:: Case of Enum Members Because Enums are used to represent constants, and to help avoid issues with name clashes between mixin-class methods/attributes and enum names, we strongly recommend using UPPER_CASE names for members, and will be using that style in our examples.
trusted_official_docs
CPython Docs
.. note:: Case of Enum Members Because Enums are used to represent constants, and to help avoid issues with name clashes between mixin-class methods/attributes and enum names, we strongly recommend using UPPER_CASE names for members, and will be using that style in our examples.
.. note:: Case of Enum Members Because Enums are used to represent constants, and to help avoid issues with name clashes between mixin-class methods/attributes and enum names, we strongly recommend using UPPER_CASE names for members, and will be using that style in our examples.
python, official-docs, cpython, P0
Local_Trusted_Corpus
e54834af-da49-4e78-844c-05ac5094f82b
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,757
supabase-export-v2
9ecce0d38494e086
.. warning:: It is possible to reload modules -- if a reloaded module contains enums, they will be recreated, and the new members may not compare identical/equal to the original members.
trusted_official_docs
CPython Docs
.. warning:: It is possible to reload modules -- if a reloaded module contains enums, they will be recreated, and the new members may not compare identical/equal to the original members.
.. warning:: It is possible to reload modules -- if a reloaded module contains enums, they will be recreated, and the new members may not compare identical/equal to the original members.
python, official-docs, cpython, P0
Local_Trusted_Corpus
e653b5cd-a4c1-4ea3-a35c-ffc529e4f32c
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,800
supabase-export-v2
2167110197f89e21
to specify a different starting value). A new class derived from :class:`Enum` is returned. In other words, the above assignment to :class:`!Animal` is equivalent to:: >>> class Animal(Enum): ... ANT = 1 ... BEE = 2 ... CAT = 3 ... DOG = 4 ...
trusted_official_docs
CPython Docs
to specify a different starting value). A new class derived from :class:`Enum` is returned. In other words, the above assignment to :class:`!Animal` is equivalent to:: >>> class Animal(Enum): ... ANT = 1 ... BEE = 2 ... CAT = 3 ... DOG = 4 ...
to specify a different starting value). A new class derived from :class:`Enum` is returned. In other words, the above assignment to :class:`!Animal` is equivalent to:: >>> class Animal(Enum): ... ANT = 1 ... BEE = 2 ... CAT = 3 ... DOG = 4 ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
e789eb36-2724-4254-9113-fcc11ab553b7
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,802
supabase-export-v2
4eb3fc9ed7a001bf
as the starting number and not ``0`` is that ``0`` is ``False`` in a boolean sense, but by default enum members all evaluate to ``True``. Pickling enums created with the functional API can be tricky as frame stack implementation details are used to try and figure out which module the enumeration is being created in (e....
trusted_official_docs
CPython Docs
as the starting number and not ``0`` is that ``0`` is ``False`` in a boolean sense, but by default enum members all evaluate to ``True``. Pickling enums created with the functional API can be tricky as frame stack implementation details are used to try and figure out which module the enumeration is being created in (e....
as the starting number and not ``0`` is that ``0`` is ``False`` in a boolean sense, but by default enum members all evaluate to ``True``. Pickling enums created with the functional API can be tricky as frame stack implementation details are used to try and figure out which module the enumeration is being created in (e....
python, official-docs, cpython, P0
Local_Trusted_Corpus
e98d2665-6812-4904-b8b8-b2ebf48204e7
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,695
supabase-export-v2
02c086c52ca416d4
= 4 ... FRIDAY = 5 ... SATURDAY = 6 ... SUNDAY = 7 ... # ... @classmethod ... def from_date(cls, date): ... return cls(date.isoweekday()) Now we can find out what today is! Observe::
trusted_official_docs
CPython Docs
= 4 ... FRIDAY = 5 ... SATURDAY = 6 ... SUNDAY = 7 ... # ... @classmethod ... def from_date(cls, date): ... return cls(date.isoweekday()) Now we can find out what today is! Observe::
= 4 ... FRIDAY = 5 ... SATURDAY = 6 ... SUNDAY = 7 ... # ... @classmethod ... def from_date(cls, date): ... return cls(date.isoweekday()) Now we can find out what today is! Observe::
python, official-docs, cpython, P0
Local_Trusted_Corpus
e9e3d1c8-dc30-4300-9255-14875c2f8be6
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,775
supabase-export-v2
fd0f2e42d7052f61
>>> class Foo(Enum): ... def some_behavior(self): ... pass ... >>> class Bar(Foo): ... HAPPY = 1 ... SAD = 2 ... Allowing subclassing of enums that define members would lead to a violation of some important invariants of types and instances. On the other hand, it makes sense to allow sharing some common behavior betwee...
trusted_official_docs
CPython Docs
>>> class Foo(Enum): ... def some_behavior(self): ... pass ... >>> class Bar(Foo): ... HAPPY = 1 ... SAD = 2 ... Allowing subclassing of enums that define members would lead to a violation of some important invariants of types and instances. On the other hand, it makes sense to allow sharing some common behavior betwee...
>>> class Foo(Enum): ... def some_behavior(self): ... pass ... >>> class Bar(Foo): ... HAPPY = 1 ... SAD = 2 ... Allowing subclassing of enums that define members would lead to a violation of some important invariants of types and instances. On the other hand, it makes sense to allow sharing some common behavior betwee...
python, official-docs, cpython, P0
Local_Trusted_Corpus
ea436ab3-98a1-40e5-af89-2d951377976d
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,743
supabase-export-v2
091cd174f1e756c6
The special attribute ``__members__`` is a read-only ordered mapping of names to members. It includes all names defined in the enumeration, including the aliases:: >>> for name, member in Shape.__members__.items(): ... name, member ... ('SQUARE', <Shape.SQUARE: 2>) ('DIAMOND', <Shape.DIAMOND: 1>) ('CIRCLE', <Shape....
trusted_official_docs
CPython Docs
The special attribute ``__members__`` is a read-only ordered mapping of names to members. It includes all names defined in the enumeration, including the aliases:: >>> for name, member in Shape.__members__.items(): ... name, member ... ('SQUARE', <Shape.SQUARE: 2>) ('DIAMOND', <Shape.DIAMOND: 1>) ('CIRCLE', <Shape....
The special attribute ``__members__`` is a read-only ordered mapping of names to members. It includes all names defined in the enumeration, including the aliases:: >>> for name, member in Shape.__members__.items(): ... name, member ... ('SQUARE', <Shape.SQUARE: 2>) ('DIAMOND', <Shape.DIAMOND: 1>) ('CIRCLE', <Shape....
python, official-docs, cpython, P0
Local_Trusted_Corpus
ea82b4d8-121e-42ff-b026-82f553955717
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,801
supabase-export-v2
cd152a6ff944300d
>>> class Animal(Enum): ... ANT = 1 ... BEE = 2 ... CAT = 3 ... DOG = 4 ... The reason for defaulting to ``1`` as the starting number and not ``0`` is that ``0`` is ``False`` in a boolean sense, but by default enum members all evaluate to ``True``.
trusted_official_docs
CPython Docs
>>> class Animal(Enum): ... ANT = 1 ... BEE = 2 ... CAT = 3 ... DOG = 4 ... The reason for defaulting to ``1`` as the starting number and not ``0`` is that ``0`` is ``False`` in a boolean sense, but by default enum members all evaluate to ``True``.
>>> class Animal(Enum): ... ANT = 1 ... BEE = 2 ... CAT = 3 ... DOG = 4 ... The reason for defaulting to ``1`` as the starting number and not ``0`` is that ``0`` is ``False`` in a boolean sense, but by default enum members all evaluate to ``True``.
python, official-docs, cpython, P0
Local_Trusted_Corpus
edfb702c-258b-424d-a037-e1569220fe8e
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,969
supabase-export-v2
6a93dd4999907af7
value ... return obj ... >>> class Color(AutoNumber): ... RED = () ... GREEN = () ... BLUE = () ... >>> Color.GREEN <Color.GREEN: 2> To make a more general purpose ``AutoNumber``, add ``*args`` to the signature::
trusted_official_docs
CPython Docs
value ... return obj ... >>> class Color(AutoNumber): ... RED = () ... GREEN = () ... BLUE = () ... >>> Color.GREEN <Color.GREEN: 2> To make a more general purpose ``AutoNumber``, add ``*args`` to the signature::
value ... return obj ... >>> class Color(AutoNumber): ... RED = () ... GREEN = () ... BLUE = () ... >>> Color.GREEN <Color.GREEN: 2> To make a more general purpose ``AutoNumber``, add ``*args`` to the signature::
python, official-docs, cpython, P0
Local_Trusted_Corpus
ef52a58b-3c1b-40f6-8084-e74566a65d1e
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,765
supabase-export-v2
00ca27676808290b
become members of this enumeration, with the exception of special methods (:meth:`~object.__str__`, :meth:`~object.__add__`, etc.), descriptors (methods are also descriptors), and variable names listed in :attr:`~Enum._ignore_`. Note: if your enumeration defines :meth:`~object.__new__` and/or :meth:`~object.__init__`, ...
trusted_official_docs
CPython Docs
become members of this enumeration, with the exception of special methods (:meth:`~object.__str__`, :meth:`~object.__add__`, etc.), descriptors (methods are also descriptors), and variable names listed in :attr:`~Enum._ignore_`. Note: if your enumeration defines :meth:`~object.__new__` and/or :meth:`~object.__init__`, ...
become members of this enumeration, with the exception of special methods (:meth:`~object.__str__`, :meth:`~object.__add__`, etc.), descriptors (methods are also descriptors), and variable names listed in :attr:`~Enum._ignore_`. Note: if your enumeration defines :meth:`~object.__new__` and/or :meth:`~object.__init__`, ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
f192607e-ba8f-43b5-92c2-a374bb3d3875
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,723
supabase-export-v2
a999348f13a95cad
Having two enum members with the same name is invalid:: >>> class Shape(Enum): ... SQUARE = 2 ... SQUARE = 3 ... Traceback (most recent call last): ... TypeError: 'SQUARE' already defined as 2
trusted_official_docs
CPython Docs
Having two enum members with the same name is invalid:: >>> class Shape(Enum): ... SQUARE = 2 ... SQUARE = 3 ... Traceback (most recent call last): ... TypeError: 'SQUARE' already defined as 2
Having two enum members with the same name is invalid:: >>> class Shape(Enum): ... SQUARE = 2 ... SQUARE = 3 ... Traceback (most recent call last): ... TypeError: 'SQUARE' already defined as 2
python, official-docs, cpython, P0
Local_Trusted_Corpus
f41e8e89-a6c6-4af8-9f1d-a9948baaaeaf
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,873
supabase-export-v2
1b0f69c167db7640
Some rules: 1. When subclassing :class:`Enum`, mix-in types must appear before the :class:`Enum` class itself in the sequence of bases, as in the :class:`IntEnum` example above. 2. Mix-in types must be subclassable. For example, :class:`bool` and :class:`range` are not subclassable and will throw an error during Enu...
trusted_official_docs
CPython Docs
Some rules: 1. When subclassing :class:`Enum`, mix-in types must appear before the :class:`Enum` class itself in the sequence of bases, as in the :class:`IntEnum` example above. 2. Mix-in types must be subclassable. For example, :class:`bool` and :class:`range` are not subclassable and will throw an error during Enu...
Some rules: 1. When subclassing :class:`Enum`, mix-in types must appear before the :class:`Enum` class itself in the sequence of bases, as in the :class:`IntEnum` example above. 2. Mix-in types must be subclassable. For example, :class:`bool` and :class:`range` are not subclassable and will throw an error during Enu...
python, official-docs, cpython, P0
Local_Trusted_Corpus
f6a2deed-2050-4974-b997-4a3ffd74f628
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,710
supabase-export-v2
24c8f4e841169124
And a function to display the chores for a given day:: >>> def show_chores(chores, day): ... for chore, days in chores.items(): ... if day in days: ... print(chore) ... >>> show_chores(chores_for_ethan, Weekday.SATURDAY) answer SO questions
trusted_official_docs
CPython Docs
And a function to display the chores for a given day:: >>> def show_chores(chores, day): ... for chore, days in chores.items(): ... if day in days: ... print(chore) ... >>> show_chores(chores_for_ethan, Weekday.SATURDAY) answer SO questions
And a function to display the chores for a given day:: >>> def show_chores(chores, day): ... for chore, days in chores.items(): ... if day in days: ... print(chore) ... >>> show_chores(chores_for_ethan, Weekday.SATURDAY) answer SO questions
python, official-docs, cpython, P0
Local_Trusted_Corpus
fa568923-7a37-4e24-a289-80b0b4848055
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,838
supabase-export-v2
131ebbb40e09599c
Any operation on an :class:`IntFlag` member besides the bit-wise operations will lose the :class:`IntFlag` membership. Bit-wise operations that result in invalid :class:`IntFlag` values will lose the :class:`IntFlag` membership. See :class:`FlagBoundary` for details.
trusted_official_docs
CPython Docs
Any operation on an :class:`IntFlag` member besides the bit-wise operations will lose the :class:`IntFlag` membership. Bit-wise operations that result in invalid :class:`IntFlag` values will lose the :class:`IntFlag` membership. See :class:`FlagBoundary` for details.
Any operation on an :class:`IntFlag` member besides the bit-wise operations will lose the :class:`IntFlag` membership. Bit-wise operations that result in invalid :class:`IntFlag` values will lose the :class:`IntFlag` membership. See :class:`FlagBoundary` for details.
python, official-docs, cpython, P0
Local_Trusted_Corpus
fabfc96e-1fe9-44fa-81ea-d02388050128
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,780
supabase-export-v2
f1c3c053515c0355
bool = field(repr=False, default=True) ... >>> class Creature(CreatureDataMixin, Enum): ... BEETLE = 'small', 6 ... DOG = 'medium', 4 ... >>> Creature.DOG <Creature.DOG: size='medium', legs=4> Use the :func:`~dataclasses.dataclass` argument ``repr=False`` to use the standard :func:`repr`.
trusted_official_docs
CPython Docs
bool = field(repr=False, default=True) ... >>> class Creature(CreatureDataMixin, Enum): ... BEETLE = 'small', 6 ... DOG = 'medium', 4 ... >>> Creature.DOG <Creature.DOG: size='medium', legs=4> Use the :func:`~dataclasses.dataclass` argument ``repr=False`` to use the standard :func:`repr`.
bool = field(repr=False, default=True) ... >>> class Creature(CreatureDataMixin, Enum): ... BEETLE = 'small', 6 ... DOG = 'medium', 4 ... >>> Creature.DOG <Creature.DOG: size='medium', legs=4> Use the :func:`~dataclasses.dataclass` argument ``repr=False`` to use the standard :func:`repr`.
python, official-docs, cpython, P0
Local_Trusted_Corpus
fb6bab75-187a-4e1b-ae60-00329199e4ab
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,954
supabase-export-v2
dab4ef787a61e968
a descriptive string as the value - use a tuple as the value and a custom :meth:`~object.__new__` to replace the tuple with an :class:`int` value Using any of these methods signifies to the user that these values are not important, and also enables one to add, remove, or reorder members without having to renumber the r...
trusted_official_docs
CPython Docs
a descriptive string as the value - use a tuple as the value and a custom :meth:`~object.__new__` to replace the tuple with an :class:`int` value Using any of these methods signifies to the user that these values are not important, and also enables one to add, remove, or reorder members without having to renumber the r...
a descriptive string as the value - use a tuple as the value and a custom :meth:`~object.__new__` to replace the tuple with an :class:`int` value Using any of these methods signifies to the user that these values are not important, and also enables one to add, remove, or reorder members without having to renumber the r...
python, official-docs, cpython, P0
Local_Trusted_Corpus
fdbf3b48-06df-4d95-abb4-e05a424c57d6
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,983
supabase-export-v2
689e254e103856fa
Raises an error if a duplicate member value is found instead of creating an alias:: >>> class DuplicateFreeEnum(Enum): ... def __init__(self, *args): ... cls = self.__class__ ... if any(self.value == e.value for e in cls): ... a = self.name ... e = cls(self.value).name ... raise ValueError( ... "aliases not allo...
trusted_official_docs
CPython Docs
Raises an error if a duplicate member value is found instead of creating an alias:: >>> class DuplicateFreeEnum(Enum): ... def __init__(self, *args): ... cls = self.__class__ ... if any(self.value == e.value for e in cls): ... a = self.name ... e = cls(self.value).name ... raise ValueError( ... "aliases not allo...
Raises an error if a duplicate member value is found instead of creating an alias:: >>> class DuplicateFreeEnum(Enum): ... def __init__(self, *args): ... cls = self.__class__ ... if any(self.value == e.value for e in cls): ... a = self.name ... e = cls(self.value).name ... raise ValueError( ... "aliases not allo...
python, official-docs, cpython, P0
Local_Trusted_Corpus
fdc6c6e5-b339-455d-a0b5-9a2827c449f9
CPython Docs
file://datasets/cpython/Doc/howto/enum.rst
unknown
3644c705-dc49-483a-ad87-2351aa24324f
59,867
supabase-export-v2
82453343035a1d65
.. note:: For the majority of new code, :class:`Enum` and :class:`Flag` are strongly recommended, since :class:`IntEnum` and :class:`IntFlag` break some semantic promises of an enumeration (by being comparable to integers, and thus by transitivity to other unrelated enumerations). :class:`IntEnum` and :class:`IntFl...
trusted_official_docs
CPython Docs
.. note:: For the majority of new code, :class:`Enum` and :class:`Flag` are strongly recommended, since :class:`IntEnum` and :class:`IntFlag` break some semantic promises of an enumeration (by being comparable to integers, and thus by transitivity to other unrelated enumerations). :class:`IntEnum` and :class:`IntFl...
.. note:: For the majority of new code, :class:`Enum` and :class:`Flag` are strongly recommended, since :class:`IntEnum` and :class:`IntFlag` break some semantic promises of an enumeration (by being comparable to integers, and thus by transitivity to other unrelated enumerations). :class:`IntEnum` and :class:`IntFl...
python, official-docs, cpython, P0
Local_Trusted_Corpus
0572a25b-d6ee-418b-99a1-35feee7b3c52
CPython Docs
file://datasets/cpython/Doc/howto/perf_profiling.rst
unknown
af0d8042-2717-4e70-a924-e16685ba6575
60,048
supabase-export-v2
471879335cc9465e
How to work without frame pointers ---------------------------------- If you are working with a Python interpreter that has been compiled without frame pointers, you can still use the ``perf`` profiler, but the overhead will be a bit higher because Python needs to generate unwinding information for every Python functio...
trusted_official_docs
CPython Docs
How to work without frame pointers ---------------------------------- If you are working with a Python interpreter that has been compiled without frame pointers, you can still use the ``perf`` profiler, but the overhead will be a bit higher because Python needs to generate unwinding information for every Python functio...
How to work without frame pointers ---------------------------------- If you are working with a Python interpreter that has been compiled without frame pointers, you can still use the ``perf`` profiler, but the overhead will be a bit higher because Python needs to generate unwinding information for every Python functio...
python, official-docs, cpython, P0
Local_Trusted_Corpus
0f14fa29-9889-46ef-a0cd-f0f09e42c949
CPython Docs
file://datasets/cpython/Doc/howto/perf_profiling.rst
unknown
af0d8042-2717-4e70-a924-e16685ba6575
60,024
supabase-export-v2
32618a9c8d5cfeb1
| | |--51.81%--_PyEval_EvalFrameDefault | | | | | | | | | |--13.77%--_PyCompactLong_Add | | | | | | | | | | | |--3.26%--_PyObject_Malloc Using the samply profiler -------------------------
trusted_official_docs
CPython Docs
| | |--51.81%--_PyEval_EvalFrameDefault | | | | | | | | | |--13.77%--_PyCompactLong_Add | | | | | | | | | | | |--3.26%--_PyObject_Malloc Using the samply profiler -------------------------
| | |--51.81%--_PyEval_EvalFrameDefault | | | | | | | | | |--13.77%--_PyCompactLong_Add | | | | | | | | | | | |--3.26%--_PyObject_Malloc Using the samply profiler -------------------------
python, official-docs, cpython, P0
Local_Trusted_Corpus
14bab73b-9525-4798-abe4-05d3b27c62b4
CPython Docs
file://datasets/cpython/Doc/howto/perf_profiling.rst
unknown
af0d8042-2717-4e70-a924-e16685ba6575
60,047
supabase-export-v2
4c8f57a6034e8fa9
your interpreter has not been compiled with frame pointers and therefore it may not be able to show Python functions in the output of ``perf``. How to work without frame pointers ----------------------------------
trusted_official_docs
CPython Docs
your interpreter has not been compiled with frame pointers and therefore it may not be able to show Python functions in the output of ``perf``. How to work without frame pointers ----------------------------------
your interpreter has not been compiled with frame pointers and therefore it may not be able to show Python functions in the output of ``perf``. How to work without frame pointers ----------------------------------
python, official-docs, cpython, P0
Local_Trusted_Corpus
197fdb73-6925-4e97-b55e-c9cbc7f558c1
CPython Docs
file://datasets/cpython/Doc/howto/perf_profiling.rst
unknown
af0d8042-2717-4e70-a924-e16685ba6575
60,044
supabase-export-v2
5cbc3a995f1cc911
information. This is because as the code that is interposed to allow ``perf`` support is dynamically generated it doesn't have any DWARF debugging information available. You can check if your system has been compiled with this flag by running::
trusted_official_docs
CPython Docs
information. This is because as the code that is interposed to allow ``perf`` support is dynamically generated it doesn't have any DWARF debugging information available. You can check if your system has been compiled with this flag by running::
information. This is because as the code that is interposed to allow ``perf`` support is dynamically generated it doesn't have any DWARF debugging information available. You can check if your system has been compiled with this flag by running::
python, official-docs, cpython, P0
Local_Trusted_Corpus
1c42f055-0c4e-4bcd-b8cb-f8bafcf83ded
CPython Docs
file://datasets/cpython/Doc/howto/perf_profiling.rst
unknown
af0d8042-2717-4e70-a924-e16685ba6575
60,061
supabase-export-v2
e863f33c3955cbde
are compiling Python with ``-O0`` and not seeing Python functions in your profiling output, try increasing the stack dump size to 65528 bytes (the maximum):: $ perf record -F 9999 -g -k 1 --call-graph dwarf,65528 -o perf.data python -Xperf_jit my_script.py
trusted_official_docs
CPython Docs
are compiling Python with ``-O0`` and not seeing Python functions in your profiling output, try increasing the stack dump size to 65528 bytes (the maximum):: $ perf record -F 9999 -g -k 1 --call-graph dwarf,65528 -o perf.data python -Xperf_jit my_script.py
are compiling Python with ``-O0`` and not seeing Python functions in your profiling output, try increasing the stack dump size to 65528 bytes (the maximum):: $ perf record -F 9999 -g -k 1 --call-graph dwarf,65528 -o perf.data python -Xperf_jit my_script.py
python, official-docs, cpython, P0
Local_Trusted_Corpus
20b95d0d-98d5-4c66-9f8e-dbabcd267b50
CPython Docs
file://datasets/cpython/Doc/howto/perf_profiling.rst
unknown
af0d8042-2717-4e70-a924-e16685ba6575
60,054
supabase-export-v2
46f39c88096055e6
extra step before you can run ``perf report``. You need to call the ``perf inject`` command to inject the JIT information into the ``perf.data`` file.:: $ perf record -F 9999 -g -k 1 --call-graph dwarf -o perf.data python -Xperf_jit my_script.py $ perf inject -i perf.data --jit --output perf.jit.data $ perf report -g...
trusted_official_docs
CPython Docs
extra step before you can run ``perf report``. You need to call the ``perf inject`` command to inject the JIT information into the ``perf.data`` file.:: $ perf record -F 9999 -g -k 1 --call-graph dwarf -o perf.data python -Xperf_jit my_script.py $ perf inject -i perf.data --jit --output perf.jit.data $ perf report -g...
extra step before you can run ``perf report``. You need to call the ``perf inject`` command to inject the JIT information into the ``perf.data`` file.:: $ perf record -F 9999 -g -k 1 --call-graph dwarf -o perf.data python -Xperf_jit my_script.py $ perf inject -i perf.data --jit --output perf.jit.data $ perf report -g...
python, official-docs, cpython, P0
Local_Trusted_Corpus
2328e804-c1fc-4f00-9d62-5db2fa97a893
CPython Docs
file://datasets/cpython/Doc/howto/perf_profiling.rst
unknown
af0d8042-2717-4e70-a924-e16685ba6575
60,046
supabase-export-v2
9cbdc4e1706708fc
$ python -m sysconfig | grep 'no-omit-frame-pointer' If you don't see any output it means that your interpreter has not been compiled with frame pointers and therefore it may not be able to show Python functions in the output of ``perf``.
trusted_official_docs
CPython Docs
$ python -m sysconfig | grep 'no-omit-frame-pointer' If you don't see any output it means that your interpreter has not been compiled with frame pointers and therefore it may not be able to show Python functions in the output of ``perf``.
$ python -m sysconfig | grep 'no-omit-frame-pointer' If you don't see any output it means that your interpreter has not been compiled with frame pointers and therefore it may not be able to show Python functions in the output of ``perf``.
python, official-docs, cpython, P0
Local_Trusted_Corpus
262f227e-6a71-4f57-a709-5c2568e99743
CPython Docs
file://datasets/cpython/Doc/howto/perf_profiling.rst
unknown
af0d8042-2717-4e70-a924-e16685ba6575
60,057
supabase-export-v2
da900a5a5e07b3f4
perf record -F 9999 -g --call-graph dwarf -o perf.data python my_script.py $ perf inject -i perf.data --jit --output perf.jit.data $ perf report -g -i perf.jit.data ``perf inject --jit`` command will read ``perf.data``, automatically pick up the perf dump file that Python creates (in ``/tmp/perf-$PID.dump``), and then ...
trusted_official_docs
CPython Docs
perf record -F 9999 -g --call-graph dwarf -o perf.data python my_script.py $ perf inject -i perf.data --jit --output perf.jit.data $ perf report -g -i perf.jit.data ``perf inject --jit`` command will read ``perf.data``, automatically pick up the perf dump file that Python creates (in ``/tmp/perf-$PID.dump``), and then ...
perf record -F 9999 -g --call-graph dwarf -o perf.data python my_script.py $ perf inject -i perf.data --jit --output perf.jit.data $ perf report -g -i perf.jit.data ``perf inject --jit`` command will read ``perf.data``, automatically pick up the perf dump file that Python creates (in ``/tmp/perf-$PID.dump``), and then ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
295b559c-b9fa-489a-be52-ed09487a53b2
CPython Docs
file://datasets/cpython/Doc/howto/perf_profiling.rst
unknown
af0d8042-2717-4e70-a924-e16685ba6575
60,051
supabase-export-v2
b5ba8bd91642b3c8
.. note:: Due to a bug in the ``perf`` tool, only ``perf`` versions higher than v6.8 will work with the JIT mode. The fix was also backported to the v6.7.2 version of the tool.
trusted_official_docs
CPython Docs
.. note:: Due to a bug in the ``perf`` tool, only ``perf`` versions higher than v6.8 will work with the JIT mode. The fix was also backported to the v6.7.2 version of the tool.
.. note:: Due to a bug in the ``perf`` tool, only ``perf`` versions higher than v6.8 will work with the JIT mode. The fix was also backported to the v6.7.2 version of the tool.
python, official-docs, cpython, P0
Local_Trusted_Corpus
389cd050-888f-490a-b813-1c0b95867a99
CPython Docs
file://datasets/cpython/Doc/howto/perf_profiling.rst
unknown
af0d8042-2717-4e70-a924-e16685ba6575
60,032
supabase-export-v2
ada6d5a4eb805cc8
support can be enabled either from the start using the environment variable :envvar:`PYTHONPERFSUPPORT` or the :option:`-X perf <-X>` option, or dynamically using :func:`sys.activate_stack_trampoline` and :func:`sys.deactivate_stack_trampoline`. The :mod:`!sys` functions take precedence over the :option:`!-X` option, t...
trusted_official_docs
CPython Docs
support can be enabled either from the start using the environment variable :envvar:`PYTHONPERFSUPPORT` or the :option:`-X perf <-X>` option, or dynamically using :func:`sys.activate_stack_trampoline` and :func:`sys.deactivate_stack_trampoline`. The :mod:`!sys` functions take precedence over the :option:`!-X` option, t...
support can be enabled either from the start using the environment variable :envvar:`PYTHONPERFSUPPORT` or the :option:`-X perf <-X>` option, or dynamically using :func:`sys.activate_stack_trampoline` and :func:`sys.deactivate_stack_trampoline`. The :mod:`!sys` functions take precedence over the :option:`!-X` option, t...
python, official-docs, cpython, P0
Local_Trusted_Corpus
40e0d653-eba4-4b0b-8e7b-c2c10e5bacbc
CPython Docs
file://datasets/cpython/Doc/howto/perf_profiling.rst
unknown
af0d8042-2717-4e70-a924-e16685ba6575
60,031
supabase-export-v2
d8cd3252d6db6fa3
How to enable ``perf`` profiling support ---------------------------------------- ``perf`` profiling support can be enabled either from the start using the environment variable :envvar:`PYTHONPERFSUPPORT` or the :option:`-X perf <-X>` option, or dynamically using :func:`sys.activate_stack_trampoline` and :func:`sys.dea...
trusted_official_docs
CPython Docs
How to enable ``perf`` profiling support ---------------------------------------- ``perf`` profiling support can be enabled either from the start using the environment variable :envvar:`PYTHONPERFSUPPORT` or the :option:`-X perf <-X>` option, or dynamically using :func:`sys.activate_stack_trampoline` and :func:`sys.dea...
How to enable ``perf`` profiling support ---------------------------------------- ``perf`` profiling support can be enabled either from the start using the environment variable :envvar:`PYTHONPERFSUPPORT` or the :option:`-X perf <-X>` option, or dynamically using :func:`sys.activate_stack_trampoline` and :func:`sys.dea...
python, official-docs, cpython, P0
Local_Trusted_Corpus
4389f10d-0965-49c2-869f-1aa20797c175
CPython Docs
file://datasets/cpython/Doc/howto/perf_profiling.rst
unknown
af0d8042-2717-4e70-a924-e16685ba6575
60,017
supabase-export-v2
6b4639667f576bd3
# Children Self Samples Command Shared Object Symbol # ........ ........ ............ .......... .................. .......................................... # 91.08% 0.00% 0 python.exe python.exe [.] _start | ---_start | --90.71%--__libc_start_main Py_BytesMain | |--56.88%--pymain_run_python.constprop.0 | | ...
trusted_official_docs
CPython Docs
# Children Self Samples Command Shared Object Symbol # ........ ........ ............ .......... .................. .......................................... # 91.08% 0.00% 0 python.exe python.exe [.] _start | ---_start | --90.71%--__libc_start_main Py_BytesMain | |--56.88%--pymain_run_python.constprop.0 | | ...
# Children Self Samples Command Shared Object Symbol # ........ ........ ............ .......... .................. .......................................... # 91.08% 0.00% 0 python.exe python.exe [.] _start | ---_start | --90.71%--__libc_start_main Py_BytesMain | |--56.88%--pymain_run_python.constprop.0 | | ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
446c0afd-37be-4914-9792-8105d4712ba3
CPython Docs
file://datasets/cpython/Doc/howto/perf_profiling.rst
unknown
af0d8042-2717-4e70-a924-e16685ba6575
60,019
supabase-export-v2
e7745e1cef35e36a
useful because all Python functions use the same C function to evaluate bytecode so we cannot know which Python function corresponds to which bytecode-evaluating function. Instead, if we run the same experiment with ``perf`` support enabled we get:
trusted_official_docs
CPython Docs
useful because all Python functions use the same C function to evaluate bytecode so we cannot know which Python function corresponds to which bytecode-evaluating function. Instead, if we run the same experiment with ``perf`` support enabled we get:
useful because all Python functions use the same C function to evaluate bytecode so we cannot know which Python function corresponds to which bytecode-evaluating function. Instead, if we run the same experiment with ``perf`` support enabled we get:
python, official-docs, cpython, P0
Local_Trusted_Corpus
45255196-e4b0-4caf-8567-6c0fa42cf1e4
CPython Docs
file://datasets/cpython/Doc/howto/perf_profiling.rst
unknown
af0d8042-2717-4e70-a924-e16685ba6575
60,001
supabase-export-v2
da08ee0df11cb2d2
:author: Pablo Galindo `The Linux perf profiler <https://perf.wiki.kernel.org>`_ and `samply <https://github.com/mstange/samply>`_ are powerful tools that allow you to profile and obtain information about the performance of your application. Both tools have vibrant ecosystems that aid with the analysis of the data they...
trusted_official_docs
CPython Docs
:author: Pablo Galindo `The Linux perf profiler <https://perf.wiki.kernel.org>`_ and `samply <https://github.com/mstange/samply>`_ are powerful tools that allow you to profile and obtain information about the performance of your application. Both tools have vibrant ecosystems that aid with the analysis of the data they...
:author: Pablo Galindo `The Linux perf profiler <https://perf.wiki.kernel.org>`_ and `samply <https://github.com/mstange/samply>`_ are powerful tools that allow you to profile and obtain information about the performance of your application. Both tools have vibrant ecosystems that aid with the analysis of the data they...
python, official-docs, cpython, P0
Local_Trusted_Corpus
4ac1c70c-4085-4e8b-9a2d-e54dafd6b452
CPython Docs
file://datasets/cpython/Doc/howto/perf_profiling.rst
unknown
af0d8042-2717-4e70-a924-e16685ba6575
60,026
supabase-export-v2
88a6a253365b1ec8
same perf map files that Python generates, making it compatible with Python's profiling support. samply is particularly useful on macOS where perf is not available. To use samply with Python, first install it following the instructions at https://github.com/mstange/samply, then run::
trusted_official_docs
CPython Docs
same perf map files that Python generates, making it compatible with Python's profiling support. samply is particularly useful on macOS where perf is not available. To use samply with Python, first install it following the instructions at https://github.com/mstange/samply, then run::
same perf map files that Python generates, making it compatible with Python's profiling support. samply is particularly useful on macOS where perf is not available. To use samply with Python, first install it following the instructions at https://github.com/mstange/samply, then run::
python, official-docs, cpython, P0
Local_Trusted_Corpus
53b79d29-8f3b-4ee0-a59a-7e04d42b7408
CPython Docs
file://datasets/cpython/Doc/howto/perf_profiling.rst
unknown
af0d8042-2717-4e70-a924-e16685ba6575
60,043
supabase-export-v2
7fccb6127702fa5d
How to obtain the best results ------------------------------ For best results, keep frame pointers enabled. On supported GCC-compatible toolchains, CPython builds itself with ``-fno-omit-frame-pointer`` and, when available, ``-mno-omit-leaf-frame-pointer`` by default. These flags allow profilers to unwind using only t...
trusted_official_docs
CPython Docs
How to obtain the best results ------------------------------ For best results, keep frame pointers enabled. On supported GCC-compatible toolchains, CPython builds itself with ``-fno-omit-frame-pointer`` and, when available, ``-mno-omit-leaf-frame-pointer`` by default. These flags allow profilers to unwind using only t...
How to obtain the best results ------------------------------ For best results, keep frame pointers enabled. On supported GCC-compatible toolchains, CPython builds itself with ``-fno-omit-frame-pointer`` and, when available, ``-mno-omit-leaf-frame-pointer`` by default. These flags allow profilers to unwind using only t...
python, official-docs, cpython, P0
Local_Trusted_Corpus
5a67f62c-8826-4927-a91e-1960df3fabf8
CPython Docs
file://datasets/cpython/Doc/howto/perf_profiling.rst
unknown
af0d8042-2717-4e70-a924-e16685ba6575
60,056
supabase-export-v2
663d05c6a47b86c0
or using the environment variable:: $ PYTHON_PERF_JIT_SUPPORT=1 perf record -F 9999 -g --call-graph dwarf -o perf.data python my_script.py $ perf inject -i perf.data --jit --output perf.jit.data $ perf report -g -i perf.jit.data
trusted_official_docs
CPython Docs
or using the environment variable:: $ PYTHON_PERF_JIT_SUPPORT=1 perf record -F 9999 -g --call-graph dwarf -o perf.data python my_script.py $ perf inject -i perf.data --jit --output perf.jit.data $ perf report -g -i perf.jit.data
or using the environment variable:: $ PYTHON_PERF_JIT_SUPPORT=1 perf record -F 9999 -g --call-graph dwarf -o perf.data python my_script.py $ perf inject -i perf.data --jit --output perf.jit.data $ perf report -g -i perf.jit.data
python, official-docs, cpython, P0
Local_Trusted_Corpus
69ca7378-ecbd-4793-a383-ad10985689a3
CPython Docs
file://datasets/cpython/Doc/howto/perf_profiling.rst
unknown
af0d8042-2717-4e70-a924-e16685ba6575
60,003
supabase-export-v2
2e94e02331f1020f
procedures written in C. This means that the names and file names of Python functions in your code will not appear in the profiler output. Since Python 3.12, the interpreter can run in a special mode that allows Python functions to appear in the output of compatible profilers. When this mode is enabled, the interpreter...
trusted_official_docs
CPython Docs
procedures written in C. This means that the names and file names of Python functions in your code will not appear in the profiler output. Since Python 3.12, the interpreter can run in a special mode that allows Python functions to appear in the output of compatible profilers. When this mode is enabled, the interpreter...
procedures written in C. This means that the names and file names of Python functions in your code will not appear in the profiler output. Since Python 3.12, the interpreter can run in a special mode that allows Python functions to appear in the output of compatible profilers. When this mode is enabled, the interpreter...
python, official-docs, cpython, P0
Local_Trusted_Corpus
6f705091-54a6-4a39-9e90-74657bd21dfb
CPython Docs
file://datasets/cpython/Doc/howto/perf_profiling.rst
unknown
af0d8042-2717-4e70-a924-e16685ba6575
60,023
supabase-export-v2
a27379a24d2b7bf5
# Children Self Samples Command Shared Object Symbol # ........ ........ ............ .......... .................. ..................................................................... # 90.58% 0.36% 1 python.exe python.exe [.] _start | ---_start | --89.86%--__libc_start_main Py_BytesMain | |--55.43%--pymain_r...
trusted_official_docs
CPython Docs
# Children Self Samples Command Shared Object Symbol # ........ ........ ............ .......... .................. ..................................................................... # 90.58% 0.36% 1 python.exe python.exe [.] _start | ---_start | --89.86%--__libc_start_main Py_BytesMain | |--55.43%--pymain_r...
# Children Self Samples Command Shared Object Symbol # ........ ........ ............ .......... .................. ..................................................................... # 90.58% 0.36% 1 python.exe python.exe [.] _start | ---_start | --89.86%--__libc_start_main Py_BytesMain | |--55.43%--pymain_r...
python, official-docs, cpython, P0
Local_Trusted_Corpus
8720bad5-1bdf-4a4e-85c7-2125e195efe6
CPython Docs
file://datasets/cpython/Doc/howto/perf_profiling.rst
unknown
af0d8042-2717-4e70-a924-e16685ba6575
60,029
supabase-export-v2
3603e4499fe51fff
data interactively. The advantage of samply is that it provides a modern web-based interface for analyzing profiling data and works on both Linux and macOS. On macOS, samply support requires Python 3.15 or later. Also on macOS, samply can't profile signed Python executables due to restrictions by macOS. You can profile...
trusted_official_docs
CPython Docs
data interactively. The advantage of samply is that it provides a modern web-based interface for analyzing profiling data and works on both Linux and macOS. On macOS, samply support requires Python 3.15 or later. Also on macOS, samply can't profile signed Python executables due to restrictions by macOS. You can profile...
data interactively. The advantage of samply is that it provides a modern web-based interface for analyzing profiling data and works on both Linux and macOS. On macOS, samply support requires Python 3.15 or later. Also on macOS, samply can't profile signed Python executables due to restrictions by macOS. You can profile...
python, official-docs, cpython, P0
Local_Trusted_Corpus
8beeabd3-f1ba-4dcd-9639-a08aadeb5fcf
CPython Docs
file://datasets/cpython/Doc/howto/perf_profiling.rst
unknown
af0d8042-2717-4e70-a924-e16685ba6575
60,049
supabase-export-v2
cae324d919ed6cdc
time to process the data because it will need to use the DWARF debugging information to unwind the stack and this is a slow process. To enable this mode, you can use the environment variable :envvar:`PYTHON_PERF_JIT_SUPPORT` or the :option:`-X perf_jit <-X>` option, which will enable the JIT mode for the ``perf`` profi...
trusted_official_docs
CPython Docs
time to process the data because it will need to use the DWARF debugging information to unwind the stack and this is a slow process. To enable this mode, you can use the environment variable :envvar:`PYTHON_PERF_JIT_SUPPORT` or the :option:`-X perf_jit <-X>` option, which will enable the JIT mode for the ``perf`` profi...
time to process the data because it will need to use the DWARF debugging information to unwind the stack and this is a slow process. To enable this mode, you can use the environment variable :envvar:`PYTHON_PERF_JIT_SUPPORT` or the :option:`-X perf_jit <-X>` option, which will enable the JIT mode for the ``perf`` profi...
python, official-docs, cpython, P0
Local_Trusted_Corpus
94bf4d46-ea55-4b31-b919-70875b357aa4
CPython Docs
file://datasets/cpython/Doc/howto/perf_profiling.rst
unknown
af0d8042-2717-4e70-a924-e16685ba6575
60,002
supabase-export-v2
409302967101c534
profile and obtain information about the performance of your application. Both tools have vibrant ecosystems that aid with the analysis of the data they produce. The main problem with using these profilers with Python applications is that they only get information about native symbols, that is, the names of functions a...
trusted_official_docs
CPython Docs
profile and obtain information about the performance of your application. Both tools have vibrant ecosystems that aid with the analysis of the data they produce. The main problem with using these profilers with Python applications is that they only get information about native symbols, that is, the names of functions a...
profile and obtain information about the performance of your application. Both tools have vibrant ecosystems that aid with the analysis of the data they produce. The main problem with using these profilers with Python applications is that they only get information about native symbols, that is, the names of functions a...
python, official-docs, cpython, P0
Local_Trusted_Corpus
96d8e8d6-789a-45b8-8909-1324a083a962
CPython Docs
file://datasets/cpython/Doc/howto/perf_profiling.rst
unknown
af0d8042-2717-4e70-a924-e16685ba6575
60,025
supabase-export-v2
3b2e993f196b7cdd
Using the samply profiler ------------------------- samply is a modern profiler that can be used as an alternative to perf. It uses the same perf map files that Python generates, making it compatible with Python's profiling support. samply is particularly useful on macOS where perf is not available.
trusted_official_docs
CPython Docs
Using the samply profiler ------------------------- samply is a modern profiler that can be used as an alternative to perf. It uses the same perf map files that Python generates, making it compatible with Python's profiling support. samply is particularly useful on macOS where perf is not available.
Using the samply profiler ------------------------- samply is a modern profiler that can be used as an alternative to perf. It uses the same perf map files that Python generates, making it compatible with Python's profiling support. samply is particularly useful on macOS where perf is not available.
python, official-docs, cpython, P0
Local_Trusted_Corpus
a1180bc9-836f-47c9-824c-94123b58b03a
CPython Docs
file://datasets/cpython/Doc/howto/perf_profiling.rst
unknown
af0d8042-2717-4e70-a924-e16685ba6575
60,060
supabase-export-v2
bda74fe664648bf5
size is too big, then ``perf`` won't be able to sample the process as frequently as it would like as the overhead will be higher. The stack size is particularly important when profiling Python code compiled with low optimization levels (like ``-O0``), as these builds tend to have larger stack frames. If you are compi...
trusted_official_docs
CPython Docs
size is too big, then ``perf`` won't be able to sample the process as frequently as it would like as the overhead will be higher. The stack size is particularly important when profiling Python code compiled with low optimization levels (like ``-O0``), as these builds tend to have larger stack frames. If you are compi...
size is too big, then ``perf`` won't be able to sample the process as frequently as it would like as the overhead will be higher. The stack size is particularly important when profiling Python code compiled with low optimization levels (like ``-O0``), as these builds tend to have larger stack frames. If you are compi...
python, official-docs, cpython, P0
Local_Trusted_Corpus
aa83df01-54d9-45fb-a465-d0a3dc97955b
CPython Docs
file://datasets/cpython/Doc/howto/perf_profiling.rst
unknown
af0d8042-2717-4e70-a924-e16685ba6575
60,030
supabase-export-v2
6ad27c9adc32ec1e
Homebrew). In order to attach to running processes on macOS, run ``samply setup`` once (and every time samply is updated) to self-sign the samply binary. How to enable ``perf`` profiling support ----------------------------------------
trusted_official_docs
CPython Docs
Homebrew). In order to attach to running processes on macOS, run ``samply setup`` once (and every time samply is updated) to self-sign the samply binary. How to enable ``perf`` profiling support ----------------------------------------
Homebrew). In order to attach to running processes on macOS, run ``samply setup`` once (and every time samply is updated) to self-sign the samply binary. How to enable ``perf`` profiling support ----------------------------------------
python, official-docs, cpython, P0
Local_Trusted_Corpus
b23af0d8-65bf-4752-a0c8-f603209d3b72
CPython Docs
file://datasets/cpython/Doc/howto/perf_profiling.rst
unknown
af0d8042-2717-4e70-a924-e16685ba6575
60,053
supabase-export-v2
029dbcdc433df54b
take into account that some distros add some custom version numbers including a ``-`` character. This means that ``perf 6.7-3`` is not necessarily ``perf 6.7.3``. When using the perf JIT mode, you need an extra step before you can run ``perf report``. You need to call the ``perf inject`` command to inject the JIT infor...
trusted_official_docs
CPython Docs
take into account that some distros add some custom version numbers including a ``-`` character. This means that ``perf 6.7-3`` is not necessarily ``perf 6.7.3``. When using the perf JIT mode, you need an extra step before you can run ``perf report``. You need to call the ``perf inject`` command to inject the JIT infor...
take into account that some distros add some custom version numbers including a ``-`` character. This means that ``perf 6.7-3`` is not necessarily ``perf 6.7.3``. When using the perf JIT mode, you need an extra step before you can run ``perf report``. You need to call the ``perf inject`` command to inject the JIT infor...
python, official-docs, cpython, P0
Local_Trusted_Corpus
c00f3b2f-f3a2-4876-9cf7-0e7082bf98f6
CPython Docs
file://datasets/cpython/Doc/howto/perf_profiling.rst
unknown
af0d8042-2717-4e70-a924-e16685ba6575
60,005
supabase-export-v2
0cc25c647a7007ab
.. note:: Support for profiling is available on Linux and macOS on select architectures. Perf is available on Linux, while samply can be used on both Linux and macOS. samply support on macOS is available starting from Python 3.15. Check the output of the ``configure`` build step or check the output of ``python -m sysc...
trusted_official_docs
CPython Docs
.. note:: Support for profiling is available on Linux and macOS on select architectures. Perf is available on Linux, while samply can be used on both Linux and macOS. samply support on macOS is available starting from Python 3.15. Check the output of the ``configure`` build step or check the output of ``python -m sysc...
.. note:: Support for profiling is available on Linux and macOS on select architectures. Perf is available on Linux, while samply can be used on both Linux and macOS. samply support on macOS is available starting from Python 3.15. Check the output of the ``configure`` build step or check the output of ``python -m sysc...
python, official-docs, cpython, P0
Local_Trusted_Corpus
c3e1776f-b5ca-44ef-9b8b-3a9ac54febae
CPython Docs
file://datasets/cpython/Doc/howto/perf_profiling.rst
unknown
af0d8042-2717-4e70-a924-e16685ba6575
60,058
supabase-export-v2
cb4fd8dad32c3b1d
also create a lot of ``jitted-XXXX-N.so`` files in the current directory which are ELF images for all the JIT trampolines that were created by Python. .. warning:: When using ``--call-graph dwarf``, the ``perf`` tool will take snapshots of the stack of the process being profiled and save the information in the ``per...
trusted_official_docs
CPython Docs
also create a lot of ``jitted-XXXX-N.so`` files in the current directory which are ELF images for all the JIT trampolines that were created by Python. .. warning:: When using ``--call-graph dwarf``, the ``perf`` tool will take snapshots of the stack of the process being profiled and save the information in the ``per...
also create a lot of ``jitted-XXXX-N.so`` files in the current directory which are ELF images for all the JIT trampolines that were created by Python. .. warning:: When using ``--call-graph dwarf``, the ``perf`` tool will take snapshots of the stack of the process being profiled and save the information in the ``per...
python, official-docs, cpython, P0
Local_Trusted_Corpus
c5a9e548-8cd6-4983-88b9-f8f1780785db
CPython Docs
file://datasets/cpython/Doc/howto/perf_profiling.rst
unknown
af0d8042-2717-4e70-a924-e16685ba6575
60,006
supabase-export-v2
246616074e26b2ca
the output of the ``configure`` build step or check the output of ``python -m sysconfig | grep HAVE_PERF_TRAMPOLINE`` to see if your system is supported. For example, consider the following script:
trusted_official_docs
CPython Docs
the output of the ``configure`` build step or check the output of ``python -m sysconfig | grep HAVE_PERF_TRAMPOLINE`` to see if your system is supported. For example, consider the following script:
the output of the ``configure`` build step or check the output of ``python -m sysconfig | grep HAVE_PERF_TRAMPOLINE`` to see if your system is supported. For example, consider the following script:
python, official-docs, cpython, P0
Local_Trusted_Corpus
c9eca92e-9ed8-4b18-9ae1-142ba1cebdcf
CPython Docs
file://datasets/cpython/Doc/howto/perf_profiling.rst
unknown
af0d8042-2717-4e70-a924-e16685ba6575
60,052
supabase-export-v2
1f368147d034b3f7
tool, only ``perf`` versions higher than v6.8 will work with the JIT mode. The fix was also backported to the v6.7.2 version of the tool. Note that when checking the version of the ``perf`` tool (which can be done by running ``perf version``) you must take into account that some distros add some custom version number...
trusted_official_docs
CPython Docs
tool, only ``perf`` versions higher than v6.8 will work with the JIT mode. The fix was also backported to the v6.7.2 version of the tool. Note that when checking the version of the ``perf`` tool (which can be done by running ``perf version``) you must take into account that some distros add some custom version number...
tool, only ``perf`` versions higher than v6.8 will work with the JIT mode. The fix was also backported to the v6.7.2 version of the tool. Note that when checking the version of the ``perf`` tool (which can be done by running ``perf version``) you must take into account that some distros add some custom version number...
python, official-docs, cpython, P0
Local_Trusted_Corpus
d0940746-404f-4734-9faa-31a26d57331a
CPython Docs
file://datasets/cpython/Doc/howto/perf_profiling.rst
unknown
af0d8042-2717-4e70-a924-e16685ba6575
60,055
supabase-export-v2
827399e818c1322a
9999 -g -k 1 --call-graph dwarf -o perf.data python -Xperf_jit my_script.py $ perf inject -i perf.data --jit --output perf.jit.data $ perf report -g -i perf.jit.data or using the environment variable::
trusted_official_docs
CPython Docs
9999 -g -k 1 --call-graph dwarf -o perf.data python -Xperf_jit my_script.py $ perf inject -i perf.data --jit --output perf.jit.data $ perf report -g -i perf.jit.data or using the environment variable::
9999 -g -k 1 --call-graph dwarf -o perf.data python -Xperf_jit my_script.py $ perf inject -i perf.data --jit --output perf.jit.data $ perf report -g -i perf.jit.data or using the environment variable::
python, official-docs, cpython, P0
Local_Trusted_Corpus
e107a1bf-956c-4d7c-b5b3-4059b2655b7e
CPython Docs
file://datasets/cpython/Doc/howto/perf_profiling.rst
unknown
af0d8042-2717-4e70-a924-e16685ba6575
60,059
supabase-export-v2
e3d5ab93641b61f9
default, the size of the stack dump is 8192 bytes, but you can change the size by passing it after a comma like ``--call-graph dwarf,16384``. The size of the stack dump is important because if the size is too small ``perf`` will not be able to unwind the stack and the output will be incomplete. On the other hand, if ...
trusted_official_docs
CPython Docs
default, the size of the stack dump is 8192 bytes, but you can change the size by passing it after a comma like ``--call-graph dwarf,16384``. The size of the stack dump is important because if the size is too small ``perf`` will not be able to unwind the stack and the output will be incomplete. On the other hand, if ...
default, the size of the stack dump is 8192 bytes, but you can change the size by passing it after a comma like ``--call-graph dwarf,16384``. The size of the stack dump is important because if the size is too small ``perf`` will not be able to unwind the stack and the output will be incomplete. On the other hand, if ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
e4175106-5088-4989-bf77-9e149c7bdedb
CPython Docs
file://datasets/cpython/Doc/howto/perf_profiling.rst
unknown
af0d8042-2717-4e70-a924-e16685ba6575
60,063
supabase-export-v2
45cd7e3ce20368c0
Different compilation flags can significantly impact stack sizes: - Builds with ``-O0`` typically have much larger stack frames than those with ``-O1`` or higher - Adding optimizations (``-O1``, ``-O2``, etc.) typically reduces stack size - Frame pointers (``-fno-omit-frame-pointer``) generally provide more reliable ...
trusted_official_docs
CPython Docs
Different compilation flags can significantly impact stack sizes: - Builds with ``-O0`` typically have much larger stack frames than those with ``-O1`` or higher - Adding optimizations (``-O1``, ``-O2``, etc.) typically reduces stack size - Frame pointers (``-fno-omit-frame-pointer``) generally provide more reliable ...
Different compilation flags can significantly impact stack sizes: - Builds with ``-O0`` typically have much larger stack frames than those with ``-O1`` or higher - Adding optimizations (``-O1``, ``-O2``, etc.) typically reduces stack size - Frame pointers (``-fno-omit-frame-pointer``) generally provide more reliable ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
ea8b6b49-8d96-48f5-a21b-cac1f61d8bed
CPython Docs
file://datasets/cpython/Doc/howto/perf_profiling.rst
unknown
af0d8042-2717-4e70-a924-e16685ba6575
60,018
supabase-export-v2
7418cf0d52eef2b9
| |--51.67%--_PyEval_EvalFrameDefault | | | | | | | | | |--11.52%--_PyCompactLong_Add | | | | | | | | | | | |--2.97%--_PyObject_Malloc ... As you can see, the Python functions are not shown in the output, only ``_PyEval_EvalFrameDefault`` (the function that evaluates the Python bytecode) shows up. Unfortunately that's ...
trusted_official_docs
CPython Docs
| |--51.67%--_PyEval_EvalFrameDefault | | | | | | | | | |--11.52%--_PyCompactLong_Add | | | | | | | | | | | |--2.97%--_PyObject_Malloc ... As you can see, the Python functions are not shown in the output, only ``_PyEval_EvalFrameDefault`` (the function that evaluates the Python bytecode) shows up. Unfortunately that's ...
| |--51.67%--_PyEval_EvalFrameDefault | | | | | | | | | |--11.52%--_PyCompactLong_Add | | | | | | | | | | | |--2.97%--_PyObject_Malloc ... As you can see, the Python functions are not shown in the output, only ``_PyEval_EvalFrameDefault`` (the function that evaluates the Python bytecode) shows up. Unfortunately that's ...
python, official-docs, cpython, P0
Local_Trusted_Corpus
f506c044-3d6f-41c0-9c9b-f923acd02748
CPython Docs
file://datasets/cpython/Doc/howto/perf_profiling.rst
unknown
af0d8042-2717-4e70-a924-e16685ba6575
60,028
supabase-export-v2
b9fb4c0051d3e06e
$ samply record PYTHONPERFSUPPORT=1 python my_script.py This will open a web interface where you can analyze the profiling data interactively. The advantage of samply is that it provides a modern web-based interface for analyzing profiling data and works on both Linux and macOS.
trusted_official_docs
CPython Docs
$ samply record PYTHONPERFSUPPORT=1 python my_script.py This will open a web interface where you can analyze the profiling data interactively. The advantage of samply is that it provides a modern web-based interface for analyzing profiling data and works on both Linux and macOS.
$ samply record PYTHONPERFSUPPORT=1 python my_script.py This will open a web interface where you can analyze the profiling data interactively. The advantage of samply is that it provides a modern web-based interface for analyzing profiling data and works on both Linux and macOS.
python, official-docs, cpython, P0
Local_Trusted_Corpus
0101d59d-957c-4114-9699-0fbc28398e25
CPython Docs
file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst
unknown
f03d6bf2-0a07-40e4-bbd5-fe293623640c
60,171
supabase-export-v2
be406db8ff72a5bf
:: async def async_sleep(seconds: float): future = asyncio.Future() time_to_wake = time.time() + seconds # Add the watcher-task to the event loop. watcher_task = asyncio.create_task(_sleep_watcher(future, time_to_wake)) # Block until the future is marked as done. await future
trusted_official_docs
CPython Docs
:: async def async_sleep(seconds: float): future = asyncio.Future() time_to_wake = time.time() + seconds # Add the watcher-task to the event loop. watcher_task = asyncio.create_task(_sleep_watcher(future, time_to_wake)) # Block until the future is marked as done. await future
:: async def async_sleep(seconds: float): future = asyncio.Future() time_to_wake = time.time() + seconds # Add the watcher-task to the event loop. watcher_task = asyncio.create_task(_sleep_watcher(future, time_to_wake)) # Block until the future is marked as done. await future
python, official-docs, cpython, P0
Local_Trusted_Corpus
0457675c-48cc-433e-b31d-47a6f9a5fc15
CPython Docs
file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst
unknown
f03d6bf2-0a07-40e4-bbd5-fe293623640c
60,084
supabase-export-v2
d516804496b64cb4
I am a lowly, simple printer, though I have all I need in life -- fresh paper and my dearly beloved octopus partner in crime. The :ref:`async def <async def>`, as opposed to just a plain ``def``, makes this an asynchronous function (or "coroutine function"). Calling it creates and returns a :ref:`coroutine <coroutine>`...
trusted_official_docs
CPython Docs
I am a lowly, simple printer, though I have all I need in life -- fresh paper and my dearly beloved octopus partner in crime. The :ref:`async def <async def>`, as opposed to just a plain ``def``, makes this an asynchronous function (or "coroutine function"). Calling it creates and returns a :ref:`coroutine <coroutine>`...
I am a lowly, simple printer, though I have all I need in life -- fresh paper and my dearly beloved octopus partner in crime. The :ref:`async def <async def>`, as opposed to just a plain ``def``, makes this an asynchronous function (or "coroutine function"). Calling it creates and returns a :ref:`coroutine <coroutine>`...
python, official-docs, cpython, P0
Local_Trusted_Corpus
05ca0add-2816-47ed-9b24-b660dd4ed7cc
CPython Docs
file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst
unknown
f03d6bf2-0a07-40e4-bbd5-fe293623640c
60,065
supabase-export-v2
85181efb465dc66e
**************************************** A conceptual overview of :mod:`!asyncio` **************************************** This :ref:`HOWTO <how-tos>` article seeks to help you build a sturdy mental model of how :mod:`asyncio` fundamentally works, helping you understand the how and why behind the recommended patterns.
trusted_official_docs
CPython Docs
**************************************** A conceptual overview of :mod:`!asyncio` **************************************** This :ref:`HOWTO <how-tos>` article seeks to help you build a sturdy mental model of how :mod:`asyncio` fundamentally works, helping you understand the how and why behind the recommended patterns.
**************************************** A conceptual overview of :mod:`!asyncio` **************************************** This :ref:`HOWTO <how-tos>` article seeks to help you build a sturdy mental model of how :mod:`asyncio` fundamentally works, helping you understand the how and why behind the recommended patterns.
python, official-docs, cpython, P0
Local_Trusted_Corpus
05f1b94e-c40c-4663-a809-cf965ceef6c6
CPython Docs
file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst
unknown
f03d6bf2-0a07-40e4-bbd5-fe293623640c
60,182
supabase-export-v2
f90f976d1489d112
async def simpler_async_sleep(seconds): time_to_wake = time.time() + seconds while True: if time.time() >= time_to_wake: return else: await YieldToEventLoop() But that's all for now. Hopefully you're ready to more confidently dive into some async programming or check out advanced topics in the :mod:`rest of the documen...
trusted_official_docs
CPython Docs
async def simpler_async_sleep(seconds): time_to_wake = time.time() + seconds while True: if time.time() >= time_to_wake: return else: await YieldToEventLoop() But that's all for now. Hopefully you're ready to more confidently dive into some async programming or check out advanced topics in the :mod:`rest of the documen...
async def simpler_async_sleep(seconds): time_to_wake = time.time() + seconds while True: if time.time() >= time_to_wake: return else: await YieldToEventLoop() But that's all for now. Hopefully you're ready to more confidently dive into some async programming or check out advanced topics in the :mod:`rest of the documen...
python, official-docs, cpython, P0
Local_Trusted_Corpus
0a627a37-0c1d-4661-98db-6d7563dcf38f
CPython Docs
file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst
unknown
f03d6bf2-0a07-40e4-bbd5-fe293623640c
60,173
supabase-export-v2
13dcd643bfcc804f
same as calling ``asyncio.sleep(0)``, but this approach offers more clarity, not to mention it's somewhat cheating to use ``asyncio.sleep`` when showcasing how to implement it! As usual, the event loop cycles through its tasks, giving them control and receiving control back when they pause or finish. The ``watcher_task...
trusted_official_docs
CPython Docs
same as calling ``asyncio.sleep(0)``, but this approach offers more clarity, not to mention it's somewhat cheating to use ``asyncio.sleep`` when showcasing how to implement it! As usual, the event loop cycles through its tasks, giving them control and receiving control back when they pause or finish. The ``watcher_task...
same as calling ``asyncio.sleep(0)``, but this approach offers more clarity, not to mention it's somewhat cheating to use ``asyncio.sleep`` when showcasing how to implement it! As usual, the event loop cycles through its tasks, giving them control and receiving control back when they pause or finish. The ``watcher_task...
python, official-docs, cpython, P0
Local_Trusted_Corpus
0c2e061a-3dfe-4f18-aefd-e198d2bdbe3b
CPython Docs
file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst
unknown
f03d6bf2-0a07-40e4-bbd5-fe293623640c
60,140
supabase-export-v2
fc81ac257f7b4761
------------------------------------------------ A conceptual overview part 2: the nuts and bolts ------------------------------------------------ Part 2 goes into detail on the mechanisms :mod:`!asyncio` uses to manage control flow. This is where the magic happens. You'll come away from this section knowing what ``awa...
trusted_official_docs
CPython Docs
------------------------------------------------ A conceptual overview part 2: the nuts and bolts ------------------------------------------------ Part 2 goes into detail on the mechanisms :mod:`!asyncio` uses to manage control flow. This is where the magic happens. You'll come away from this section knowing what ``awa...
------------------------------------------------ A conceptual overview part 2: the nuts and bolts ------------------------------------------------ Part 2 goes into detail on the mechanisms :mod:`!asyncio` uses to manage control flow. This is where the magic happens. You'll come away from this section knowing what ``awa...
python, official-docs, cpython, P0
Local_Trusted_Corpus
0d157fdd-e0f2-4e49-9593-79e731f60941
CPython Docs
file://datasets/cpython/Doc/howto/a-conceptual-overview-of-asyncio.rst
unknown
f03d6bf2-0a07-40e4-bbd5-fe293623640c
60,165
supabase-export-v2
93177829ee245904
We'll go through an example of how you could leverage a future to create your own variant of asynchronous sleep (``async_sleep``) which mimics :func:`asyncio.sleep`. This snippet registers a few tasks with the event loop and then awaits the task created by ``asyncio.create_task``, which wraps the ``async_sleep(3)`` cor...
trusted_official_docs
CPython Docs
We'll go through an example of how you could leverage a future to create your own variant of asynchronous sleep (``async_sleep``) which mimics :func:`asyncio.sleep`. This snippet registers a few tasks with the event loop and then awaits the task created by ``asyncio.create_task``, which wraps the ``async_sleep(3)`` cor...
We'll go through an example of how you could leverage a future to create your own variant of asynchronous sleep (``async_sleep``) which mimics :func:`asyncio.sleep`. This snippet registers a few tasks with the event loop and then awaits the task created by ``asyncio.create_task``, which wraps the ``async_sleep(3)`` cor...
python, official-docs, cpython, P0
Local_Trusted_Corpus