C indirection11/14/2022 The variable known as underTheBed contains a reference to a string object, which in turn identifies the Back Porch as the end of the path.įortunately, unlike children playing the party game, Python programmers are not required to traverse the path one step at a time. The variable known as kitchenCabinet contains a reference or pointer to the variable known as underTheBed. In this simple example, the variable (area of memory) known as mailbox contains a reference or pointer to the variable known as kitchenCabinet. C INDIRECTION CODEFigure 1 contains a Python code fragment that illustrates the children’s game mentioned above: Most modern programming languages make use of indirection in some form or another, and Python is no exception. C INDIRECTION FULLThere they would find a box full of goodies. This process might continue through several more notes until finally they would find a note telling them to look on the back porch. There they would find a note telling them to go look under the bed. When they did, they would find a note telling them to go look in the kitchen cabinet. Indirection works something like a party game that I recall from my childhood.Īn adult would tell the children to go look in the mailbox. I remember reading somewhere “Almost any programming problem can be solved with enough levels of indirection.” While this statement may not be absolutely true, it does serve to illustrate the importance of indirection in modern computer programming. To begin with, indirection is one of the most important programming concepts in modern computer programming. See previous lessons in this series for a more detailed description. It can contain references to any type of object. What Is a Tuple?Ī tuple is an immutable ordered list of objects. C INDIRECTION HOW TOThis lesson will teach you how to use indirection to modify the value of an object referred to by a tuple item.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |