Python Forum
TypeError: __init__() missing 3 required positional arguments
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TypeError: __init__() missing 3 required positional arguments
#7
(Jan-21-2019, 03:37 PM)snippsat Wrote:
(Jan-21-2019, 03:21 AM)Pythonhelp82 Wrote: TypeError: __init__() missing 3 required positional arguments: 'MemberName', 'MemberID', and 'SubscriptionPaid'
As you have it now NewMember=JuniorMember('Ali', 4444, True)
Set default arguments,the can use it like this.
class JuniorMember(Member):
    def __init__(self, MemberName='', MemberID='', SubscriptionPaid=''):
        super().__init__(MemberName, MemberID, SubscriptionPaid)
        self.DateOfBirth = ""

    def SetDateOfBirth(self, Date):
        self.DateOfBirth = Date
Use:
>>> NewMember = JuniorMember()
>>> NewMember.SetMemberName("Ali")
>>> NewMember.SetMemberID("12345")
>>> NewMember.MemberID
'12345'
>>> NewMember.MemberName
'Ali'

Thank you so much in helping me understand and fix this programming problem.
Reply


Messages In This Thread
RE: TypeError: __init__() missing 3 required positional arguments - by Pythonhelp82 - Jan-24-2019, 04:25 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  TypeError: __init__() missing 1 required positional argument: 'successor siki 1 4,302 Mar-08-2021, 02:05 PM
Last Post: Larz60+
  Missing 1 required positional argument in python code edwinostby 7 9,933 Jan-19-2021, 12:52 PM
Last Post: Serafim
  Missing positional arguments error?? hhydration 2 2,147 Oct-01-2020, 05:33 AM
Last Post: buran
  TypeError: Missing required positional arguments liaisa 7 28,980 Sep-25-2020, 08:16 PM
Last Post: deanhystad
  missing positional argument error programmert 1 2,821 Oct-18-2019, 11:05 AM
Last Post: Larz60+
  missing 1 required positional argument jedmond2 4 6,690 Sep-19-2019, 12:00 PM
Last Post: jefsummers
  missing 1 required positional argument mcgrim 10 19,755 May-07-2019, 09:02 PM
Last Post: Yoriz
  TypeError: method missing 1 positional argument koolinka 4 5,028 Nov-18-2018, 04:53 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

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