- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is a dot operator in Python?
Almost everything in Python is an object. Every object has certain attributes and methods. The connection between the attributes or the methods with the object is indicated by a “dot” (”.”) written between them.
For example if dog is a class, then a dog named Fido would be its instance/object.
class Dog: Fido = Dog()
If methods of the class are like eats(), runs(), sleeps() we can write Fido.eats(), Fiido.runs(), Fido.sleeps() and say Fido has attributes like Fido.size = tall, Fido.hair_color = brown
So dot notation makes it possible to access the attributes, methods and instances of a class and to access attributes and methods of the class instances.
- What is dot operator in Java?
- What is dot operator in C++?
- What is python .. ("dot dot") notation syntax?
- What is the difference between the dot (.) operator and -> in C++?
- What is @ operator in Python?
- What is operator binding in Python?
- What is tilde (~) operator in Python?
- What is modulo % operator in Python?
- How do we access class attributes using dot operator in Python?
- What is function of ^ operator in Python
- What is a Ternary operator/conditional operator in C#?
- What is "is not" operator in Python?
- What is Python equivalent of the ! operator?
- What is "not in" operator in Python?