Python - Name

Card Puncher Data Processing

About

Language - Name (Program Entity) in Python

Names (refer to|are pointer for) objects.

Names are introduced by name binding operations such as during the def process.

Binding operations

identifiers

  • targets that are identifiers if occurring in an assignment, for loop header, or after as in a with statement or except clause.
  • formal parameters to functions,

class definitions

class (these bind the class or name in the defining block)

function definitions

function definitions (these bind the function name in the defining block)

Import

The import statement .

The import statement of the form from … import * binds all names defined in the imported module, except those beginning with an underscore. This form may only be used at the module level.

Scope

Python - Name Scope

  • If a name is bound in a block, it is a local variable of that block, unless declared as nonlocal or global.
  • If a name is bound at the module level, it is a global variable. (The variables of the module code block are local and global.)
  • If a variable is used in a code block but not defined there, it is a free variable.

NameError

When a name is not found at all, a NameError exception is raised.

Documentation / Reference





Discover More
Card Puncher Data Processing
Language - (Import|Include|Require)

import basically makes names (generally of function) available to the current script. To load modules, language uses different expression: imports includes. require (Node) The import functionality...
Card Puncher Data Processing
Python - (def|define) function (procedure)

def function are one type of function declaration. See . Functions (called also procedure) are defined using the keyword def that stands for define where: the argument is the calling variable...
Card Puncher Data Processing
Python - Data Type

data (type|structure) in Python of a name generally a variable objecttypeintsstringsfunctionsclassesclass - an integer is a positive or negative whole number. float booleans (True...
Card Puncher Data Processing
Python - Name Scope

in Python A scope defines the visibility of a name within a block. If a local variable is defined in a block, its scope includes that block. If the definition occurs in a function block, the scope...
Card Puncher Data Processing
Python - Variable

in Python. A variable name must start with a letter and must exclude certain special symbols such as the dot (period). The underscore is allowed in a variable name. The variable being assigned to is...
Card Puncher Data Processing
Python Package - Import

import functionality in Python In order to use the names (generally, variable and function definitions) defined in a module, you must either: import the module itself or import the specific definitions,...



Share this page:
Follow us:
Task Runner