I don't really understand the sentence, "All objects in Python are first-class objects." I think I know what the first-class object is by looking at the rough explanation.
I mean... I want to know the name of the rank like "Beef Rating."
programming-language
What is a first-class object condition
You can put objects in a collection such as variables or lists. Can be transferred as a function or method parameter It can be used as a return value for a function or method.
There's a lamp.
Among the languages we use a lot, JavaScript, Python is a first-class object language, not c, pascal, or c++.
If you look at JavaScript or Python, you can pass the name of the function as a parameter, and you can use the function within other functions. But if you look at the c, it's impossible It must be passed using a function pointer.
Similarly, even with the return type, Python can be sent freely, but c must also return the pointer.
So in Python, a function or a method is a first-class object, but not in c. It's not a good or bad concept.
However, the characteristics of first-class objects are an important point, especially in functional languages.
Objects that meet certain conditions are called first-class objects.
In a way, something that satisfies the conditions of the First-class citizen seems very common sense and intuitive.
The terms and conditions of the Firm-class Citizen are as follows:
Simply put, it is understood that it has all the characteristics of an object as a first-class object.
If you say first-class function, you can understand that function is a function that is treated as an object.
It's like a callable object Haha..
© 2024 OneMinuteCode. All rights reserved.