Created
July 9, 2024 11:47
-
-
Save WindyNova/59001bbf09a3e52ba72f5d8c7c7b26c4 to your computer and use it in GitHub Desktop.
Python Metaprogramming Hello World
This file contains hidden or 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
| class Person: | |
| def __init__(self, **kwargs): | |
| for key, value in kwargs.items(): | |
| setattr(self, key, value) | |
| person = Person(name="Alice", age=30, job="Engineer") | |
| print(f"Name: {person.name}, Age: {person.age}, Job: {person.job}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment