Skip to Main Content
Python Programming: A modular approach
book

Python Programming: A modular approach

by Kumar Naveen, Taneja Sheetal
January 2017
Intermediate to advanced content levelIntermediate to advanced
606 pages
14h 1m
English
Pearson Education India
Content preview from Python Programming: A modular approach

CHAPTER 5

SCOPE

CHAPTER OUTLINE

5.1 Objects and Object IDs

5.2 Scope of Objects and Names

In this chapter, we will review the objects and their mapping to names, the scope of names and parameter passing mechanisms in Python. Recall that in Python, the terms name and variable are used as synonyms.

5.1 OBJECTS AND OBJECT ids

Each object in Python is assigned a unique identifier that can be accessed using the function id.

 

each Python object has a unique identifier

 

image

Fig. 5.1 Program to illustrate objects and their ids (objectId.py)

On an execution of the above script (Fig. 5.1), it produced the following output:

variables a and b refer to ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Modular Programming with Python

Modular Programming with Python

Erik Westra
Python Programming Blueprints

Python Programming Blueprints

Daniel Furtado, Marcus Pennington

Publisher Resources

ISBN: 9789352866038