课程: Programming Concepts for Python

免费学习该课程!

今天就开通帐号,24,700 门业界名师课程任您挑!

Object names

Object names

- As we create and use objects in our programs, we need a way to refer to them, and this can be accomplished by binding names to those objects. Take this shirt, for example. It's a solid color, so I'm going to use the name red shirt to refer to it. If I'm wearing the red shirt, that means I'm wearing this specific object. Now, red shirt itself is not an object. Red shirt is just a name that I use to refer to this specific object. And just like in real life, it's possible to have multiple names for the same object. - Ah, your crimson shirt, I like it. - As you can see, Olivia has a different name for my shirt. - It's a crimson shirt. - I'm not sure what crimson is, so I call this my red shirt. We have two different names that we use to refer to the same object, but there is only this one shirt. That means if I spill juice on the red shirt- - The crimson shirt is gross and sticky. And if I decide to toss the crimson…

内容