pythonbindable

Python bindable entities?


I saw that, in the book, Programming Language Design Concepts by John Wiley, 2004, there is a definition for bindables:

"A bindable entity is one that may be bound to an identifier. Programming languages vary in the kinds of entity that are bindable:

• C’s bindable entities are types, variables, and function procedures.

• JAVA’s bindable entities are values, local variables, instance and class variables, methods, classes, and packages.

• ADA’s bindable entities include types, values, variables, procedures, exceptions, packages, and tasks."

I'm curious, which bindable entities are in Python?


Solution

  • Any object has an identifier in Python and everything is a object. id() function would give an identier for any object:

    id(1)
    a = 1  
    id(a)
    import re
    id(re)
    foo = lambda x: x
    id(foo)
    

    Update: something which is not on object are the statements, but one would not expect them to be (see here):

    id(if)
    # SyntaxError: invalid syntax