What is the First-Class of Python?

2

The first-class Java language are objects, because you can not create anything in Java without the use of classes. In Haskell, following the same criteria as before, the first-class functions. In the case of Python, what is considered the first-class of the language?

    
asked by anonymous 19.10.2017 / 19:39

1 answer

-4

Everything in python is a first-class, since everything is object and object is first-class. In other words, a class, a function, a method ... are assignable, referable, and so on, they use the standard data structure of the language. In java this is not true. Here is 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: link

But in Java it is possible to say that objects and primitive types are first-class.

Ref: link

    
06.11.2017 / 16:35