# Double Under (Dunder) Methods

## The string Dunder method:

```python
class Employee:
	def __init__(self, name, age):
		self.name = name
		self.age = age
		
	def __str__(self):
		return self.name + " Age is " + str(self.age)
		
tom = Employee("Tom Lanister", 47)
print(tom)
```

* Returns the variables as strings
* Printing: "Tom Lanister Age is 47"

## The len Dunder method:

```python
	def __len__(self):
		return self.age
```

* Returns the len of the variable specified

[Good collection of other Dunder methods](https://www.geeksforgeeks.org/dunder-magic-methods-python/)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.arkannis.net/programming/courses/python-pcap-31-03-course/modules-packages-and-oop/double-under-dunder-methods.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
