
When I learned python decorators I found a very interesting concept: First Class Object. A
function in python is said to be a first class object.
So what is First Class Object? Indeed, it is an entity that can be dynamically created, destroyed,
passed to a function, returned as a value, and have all the rights as other objects.
Depending on the language, the first class object can be:
- expressible as an anonymous literal value
- storable in variables
- storable in data structures
- have an intrinsic identity (independent of any given name)
- comparable for equality with other entities
- passable as a parameter to a procedure/function
- returnable as the result of a procedure/function
- constructible at runtime
- printable
- readable
- transmissible among distributed processes
- storable outside running processes
Wiki:First class function




近期评论