In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "how to judge the equality of objects in python". The content is simple and clear. I hope it can help you solve your doubts. Let me lead you to study and learn this article "how to judge the equality of objects in python".
How to judge the equality of objects in python
The first are the = = and equal methods of strings in C #. "=":
For built-in value types, = = determines whether two memory values are equal.
For user-defined value types (Struct), = = needs to be overloaded, otherwise it cannot be used.
For reference types, true is returned by default with the same reference, but the system overloads many reference types (such as string mentioned below), so the comparison of reference types in c # is not recommended. "equals":
For value types, memory equals to return true.
For reference types, pointing to the same reference is equal.
But what is special is the string String, which is a special referential type. In the C # language, the equals () method of string is overloaded to make the string object work as if it were a value type. = in python
The object in python contains three elements: id, type, and valueid are used to identify a unique object, type identifies the type of object, and value is used to set the value of the object. Is determines whether it is an object or not, using id to determine.
= = is to determine whether the value of an object is the value of b object, and its _ _ eq__ method is called by default.
What does python mean Python is a cross-platform, interpretive, compiled, interactive and object-oriented scripting language, originally designed to write automated scripts, and is often used to develop independent and large-scale projects as versions are constantly updated and new features are added.
The above is all the contents of the article "how to judge the equality of objects in python". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.