8000 Fix USERS f-string for last name. · e1teck/Clean-Code-in-Python@8f43622 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8f43622

Browse files
committed
Fix USERS f-string for last name.
Add __repr__ for User Class in printing behalf. comply tp PEP-8 and to general convention that eval(repr(x)) should be x, thanks @rmariano
1 parent 826de50 commit 8f43622

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Chapter03/packing_1.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ def __init__(self, user_id, first_name, last_name):
1212
self.user_id = user_id
1313
self.first_name = first_name
1414
self.last_name = last_name
15+
1516
def __repr__(self):
16-
return str(self.user_id) + ' ' + self.first_name + ' ' + self.last_name
17+
return f"{self.__class__.__name__}({self.user_id!r}, {self.first_name!r}, {self.last_name!r})"
1718

1819

1920
def bad_users_from_rows(dbrows) -> list:

0 commit comments

Comments
 (0)
0