X Tutup
using System; using System.Collections.Generic; namespace Python.Runtime { /// /// Compares Python object wrappers by Python object references. /// Similar to but for Python objects /// [Serializable] public sealed class PythonReferenceComparer : IEqualityComparer { public static PythonReferenceComparer Instance { get; } = new PythonReferenceComparer(); public bool Equals(PyObject? x, PyObject? y) { return x?.rawPtr == y?.rawPtr; } public int GetHashCode(PyObject obj) => obj.rawPtr.GetHashCode(); private PythonReferenceComparer() { } } }
X Tutup