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