官术网_书友最值得收藏!

  • Python Essentials
  • Steven F. Lott
  • 203字
  • 2021-07-16 13:53:12

Chapter 4. Variables, Assignment and Scoping Rules

An expression creates objects; we can assign objects to variables to preserve them for future use. Python offers a number of variations on the theme of assignment. In addition to simply assigning a single variable, we can assign items from a tuple to multiple variables. We can also combine an operator with assignment, which updates a mutable object.

In this chapter, we'll also look at the input() function as a way to introduce new objects into a running script. This is limited—it doesn't compare with a proper graphical user interface (GUI). It will, however, help us learn more Python programming techniques before we introduce how to read data from files and the filesystem in Chapter 10, Files, Databases, Networks, and Contexts.

We'll also look at some important Python language concepts. We'll look at the way Python programs are always written generically, without specific bindings to data types or classes. We'll also look at the general concept of a namespace, and how this is applied widely in various Python language constructs. It defines the scope in which an identifier is visible; something that will become increasingly important as our programs become more complex.

主站蜘蛛池模板: 子长县| 宁海县| 文登市| 陆丰市| 长宁区| 清涧县| 辽宁省| 沭阳县| 平利县| 开原市| 龙门县| 彰化市| 遂溪县| 彰化市| 闸北区| 伊川县| 龙岩市| 韩城市| 新田县| 油尖旺区| 兴业县| 南宁市| 玉环县| 罗田县| 宜章县| 基隆市| 祁连县| 泌阳县| 定陶县| 铁岭县| 林口县| 襄樊市| 明光市| 柳林县| 静宁县| 来宾市| 新野县| 江口县| 丁青县| 远安县| 肥乡县|