Skip to content

Commit e007beb

Browse files
authored
Exploit the opportunity for using a dataclass
1 parent 629a21e commit e007beb

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎README.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -576,12 +576,12 @@ print(new_name) # ['Ryan', 'McDermott']
576576

577577
**Also good**
578578
```python
579+
from dataclasses import dataclass
580+
581+
@dataclass
579582
class Person:
580583
name: str
581-
582-
def __init__(self, name: str):
583-
self.name = name
584-
584+
#########
585585
@property
586586
def name_as_first_and_last(self) -> list:
587587
return self.name.split()

0 commit comments

Comments
 (0)