Created
March 19, 2020 07:25
-
-
Save xb4dc0d3/0f4789ce33a3abdc2bcf93c8aa54d4a0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Bad | |
def create_user_mahasiswa(self, name, username, student_no, telephone_num, gender): | |
self.name = name | |
self.username = username | |
self.student_no = student_no | |
self.telephone_num = telephone_num | |
self.gender = gender | |
# Good | |
class Mahasiswa: | |
def __init__(self, config: dict): | |
self.name = config["name"] | |
self.username = config["username"] | |
self.student_no = config["student_no"] | |
self.telephone_num = config["telephone_num"] | |
self.gender = config["gender"] | |
mahasiswa = Mahasiswa( | |
{ | |
"name": "Rudi Sutanto", | |
"username": "rudi.sutanto", | |
"student_no": "123456789", | |
"telephone_num": "081212345678", | |
"gender": "Male" | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment