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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

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.