Jump to content
Sign in to follow this  
dil_bert

What is a dot operator in Python? And how powerful is it!?

Recommended Posts


What is a dot operator in Python? And how powerful is it!?

well - if we say that almost everything in Python is an object. And furthermore - every object has certain attributes and methods.
The connection between the attributes or the methods with the object is indicated _with_ - or let us say _by_ a “dot” (”.”) written between the attributes or the methods and the object.

let us illustrate this with a little Example; if we look at Lessie the dog. This dog does alot of things - he runs, walks, bites, sleeps and lots of other thigns more.
Here’s how we can spell out the above mentioend behaviour in a so called object-oriented style - well we might write this:

Lessie = Dog()
Lessie.walks()
Lessie.wows()
Lessie.runs()
Lessie.bites()
Lessie.eats()

and so forth and so forth

Besides the above mentioened things - we can say that Lessie has additionaly and furthermore lets say different attributes and different qualities.

the question is: can objects have even more objects that belong to them


Lessie.head.hair()
Lessie.head.hair.color = "browm";
Lessie.head.mouth.theeth.length.()


quesiton: can objects have even other objects that also do belong to them - in other words - do they are able to have a connection to the object with their own methods or attributes:

 

Edited by dil_bert

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.