Python Forum
another positional argument error (...and executing objects stored in a list)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
another positional argument error (...and executing objects stored in a list)
#6
This bit of code is your problem:

            for i in shape_list:
                if i.isCircle():
                    circle.draw()
                elif i.isRectangle():
                    rectangle.draw()
You want to draw i, but you are drawing circle. The circle variable is rewritten every time you enter a new circle, and then appended to shape_list. Also note that both Circle and Rectangle objects have a draw method, so you don't need to figure out what type of shape it is to draw it. Try this instead:

            for shape in shape_list:
                shape.draw()
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
RE: another positional argument error (...and executing objects stored in a list) - by ichabod801 - Nov-16-2018, 05:57 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  TypeError: __init__() missing 1 required positional argument: 'successor siki 1 4,444 Mar-08-2021, 02:05 PM
Last Post: Larz60+
  Missing 1 required positional argument in python code edwinostby 7 10,374 Jan-19-2021, 12:52 PM
Last Post: Serafim
  Missing positional arguments error?? hhydration 2 2,244 Oct-01-2020, 05:33 AM
Last Post: buran
  List of Objects print <__main. Problem Kol789 10 3,741 Jul-21-2020, 09:37 AM
Last Post: DeaD_EyE
  missing positional argument error programmert 1 2,908 Oct-18-2019, 11:05 AM
Last Post: Larz60+
  missing 1 required positional argument jedmond2 4 7,005 Sep-19-2019, 12:00 PM
Last Post: jefsummers
  missing 1 required positional argument mcgrim 10 20,134 May-07-2019, 09:02 PM
Last Post: Yoriz
  sorting a deck of cards (objects in a list) itmustbebunnies 1 7,332 Dec-05-2018, 02:44 AM
Last Post: ichabod801
  TypeError: method missing 1 positional argument koolinka 4 5,232 Nov-18-2018, 04:53 PM
Last Post: ichabod801
  Class positional argument error itmustbebunnies 2 3,099 Nov-07-2018, 11:09 AM
Last Post: stullis

Forum Jump:

User Panel Messages

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