mrkn / pycall.rb

Calling Python functions from the Ruby language
MIT License
1.05k stars 72 forks source link

Lack of the way to check object identity #118

Open mrkn opened 4 years ago

mrkn commented 4 years ago

In Python, we can check object identity by x is y expression. PyCall should provide a way to do it.

>> idx = Pandas::Index.new([*0...3])
>> idx
=> Int64Index([0, 1, 2], dtype='int64')
>> s = Pandas::Series.new([2.71, 3.14, 42.0], index: idx)
>> s.index.
>> s.index.equal?(idx)
=> false
>> PyCall.eval("lambda x, y: x is y").(idx, s.index)
=> true