The Python Oracle

How can you set class attributes from variable arguments (kwargs) in python

Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn

--

Music by Eric Matyas
https://www.soundimage.org
Track title: Secret Catacombs

--

Chapters
00:00 Question
00:58 Accepted answer (Score 229)
01:38 Answer 2 (Score 180)
01:55 Answer 3 (Score 19)
02:25 Answer 4 (Score 15)
03:48 Thank you

--

Full question
https://stackoverflow.com/questions/8187...

Answer 1 links:
[setattr()]: https://docs.python.org/3/library/functi...
[getattr()]: https://docs.python.org/3/library/functi...

Answer 2 links:
[@fqxp]: https://stackoverflow.com/a/8187408/3357...
[@mmj]: https://stackoverflow.com/a/32019483/335...

Answer 3 links:
[fqxp's answer]: https://stackoverflow.com/a/8187408/3357...
[the ]: http://zetcode.com/python/dataclass/

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python

#avk47