Everything in python is a first-class, as everything is Object and Object is first-class. That is, a class, a function, a method... are assignable, referential, and so on, using the standard data structure of the language.
In java, that’s not true.
Follows a demonstration:
Python:
class A:
pass
def test():
pass
print(isinstance(test,object))
a = 1
print(isinstance(a,object))
a = A()
print(isinstance(a,object))
print(isinstance(A,object))
Java:
public class Test {
public static void main(String... args){
int a = 1;
System.out.println( a instanceof Object);
}
}
Ref: https://docs.python.org/3/reference/datamodel.html
But in java it is possible to say that primitive objects and types are first-class.
Ref: https://en.wikipedia.org/wiki/First-class_citizen
Anything can be first class, nothing needs to be, so wanting to choose one makes no sense. This idea that objects are first-class in Java is false. https://answall.com/q/227485/101 Indeed even the idea that everything depends on class, that everything is object-oriented is true.
– Maniero