Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
questions about dict.get
#3
self is the first argument to any instance method. It is the instance that called the method. In your example:
dict_1.get('ali')
"self" in get() would be dict_1.

/ in the argument list indicates that all arguments left of the / are position only arguments. This is why you got an error when trying to use the keyword "default". * is a similar delimiter. All arguments right of * are keyword only arguments. You can read about them here:

https://realpython.com/python-asterisk-a...arameters/
akbarza likes this post
Reply


Messages In This Thread
questions about dict.get - by akbarza - Apr-19-2024, 06:21 AM
RE: questions about dict.get - by Larz60+ - Apr-19-2024, 08:30 AM
RE: questions about dict.get - by deanhystad - Apr-19-2024, 01:53 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Questions about elements in dict new_to_python 5 2,228 Feb-08-2020, 02:47 PM
Last Post: new_to_python
  Discord bot that asks questions and based on response answers or asks more questions absinthium 1 45,431 Nov-25-2017, 06:21 AM
Last Post: heiner55

Forum Jump:

User Panel Messages

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