How do you compare Python objects with .NET objects?

PythonServer Side ProgrammingProgramming

By default, all .NET objects are reference types and their equality and hash code is determined by their memory address. Additionally, assigning a variable to an existing object just makes it point to that address in memory, so there is no costly copying occurring. It appears that this is true for python objects as well to certain extent.

Properties of Python objects: All python objects have

a unique identity (an integer, returned by id(x)); a type (returned by type(x))

You cannot change the identity; You cannot change the type.

Some objects allow you to change their content (without changing the identity or the type, that is).

Some objects don’t allow you to change their content.

The type is represented by a type object, which knows more about objects of this type.

raja
Published on 24-Jan-2018 16:08:56
Advertisements