Delegates Decorator
```python
class Person:
def __init__(self, name, age):
self.name = name
self.age = age
class Student(Person):
def __init__(self, name, age, grade):
super().__init__(name, age)
self.grade = grade
```
```python
student = Student("Alice", 12, 'A')
print(student.name, student.age, student.grade)
```
```python
kid = Student("Uma", 5.5, 'Good Kid!')
print(kid.name, kid.age, kid.grade)
```
```python
%pip install fastcore
```
```python
from fastcore.meta import delegates
```
```python
class Person:
def __init__(self, name, age, **kwargs):
self.name = name
self.age = age
@delegates()
class Student(Person):
def __init__(self, name, age, grade, **kwargs):
super().__init__(name, age, **kwargs)
self.grade = grade
```
```python
child = Student("Amira", 6, grade='A', school='XYZ')
child.__dict__
```
```python
from fastcore.basics import GetAttr
```
```python
class Strawberry(GetAttr):
def __init__(self, color, variety):
self.color, self.variety = color, variety
self.default = color
```
```python
s = Strawberry('red', 'Pegasus')
s.color, s.variety, s.default
```
```python
[s for s in dir(s) if not s.startswith('_')]
```
```python
def play(game, player='Daddy', num_players=2):
print(f'{player} is playing {game}')
play('chess', 'Mehdiya')
```
```python
@delegates(play)
def play_chess(player, speed='blitz', **kwargs):
play('chess', player)
play_chess('Uma')
```
```python
print(play_chess.__signature__)
```
```python
import inspect
print(inspect.signature(play_chess))
```
```python
print(inspect.signature(play))
```