Python Forum
collector of a bunch of named stuff
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
collector of a bunch of named stuff
#2
**kwds (usually **kwargs) takes the named parameters passed to the function and provides them to the function as a dictionary of the names as keys with the values passed to them. An attribute of a class instance is just key in the instance's __dict__, which is also a dictionary. That is, foo.bar is the same as foo.__dict__['bar']. So you use the update method to added the named parameters and their values to the attributes for the instance.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
collector of a bunch of named stuff - by Skaperen - Sep-28-2018, 11:16 PM
RE: collector of a bunch of named stuff - by ichabod801 - Sep-29-2018, 03:20 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Trusting the garbage collector Mekire 3 2,808 Mar-29-2018, 04:20 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020