Class PyNameAttribute
Names a property or field by the Python attribute it stands for, where the default mapping (the snake_case form
of the C# name) would not give it: [PyName("_disable_render_order_enforcing")]. A non-public member takes
part in Python attribute access only when it carries this attribute. On a constructor parameter it is the keyword
make binds to it (Construct(Type, IReadOnlyDictionary<string, object?>)), for the rare kwarg snake_case cannot spell. On a class it
is the name Python prints for it (DR-24): the vector wrappers renamed for unique class names
(NormalizeObservationVector) keep Gymnasium's (NormalizeObservation) in repr and messages. On
a static method it is the Python function the method stands for where C# cannot use that name
(StepApiCompatibility.Dispatch is step_api_compatibility, the class's own name). On an enum and its
members it is the Python enum and constant each stands for (DR-68: MjtState.FullPhysics is
mjtState.mjSTATE_FULLPHYSICS).
[AttributeUsage(AttributeTargets.Class|AttributeTargets.Enum|AttributeTargets.Method|AttributeTargets.Property|AttributeTargets.Field|AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)]
public sealed class PyNameAttribute : Attribute
- Inheritance
-
PyNameAttribute
- Inherited Members
- Extension Methods
Remarks
An overriding property inherits its base's name (Inherited), but a class's name is read from the class
itself only (PyTypeName(Type)): a subclass prints its own name, as a Python subclass does.
Constructors
PyNameAttribute(string)
Maps the member to name.
public PyNameAttribute(string name)
Parameters
namestringThe Python attribute name, spelled exactly as in the Gymnasium source.
Properties
Name
The Python attribute name.
public string Name { get; }