Greg Nielsen wrote:
> if crash:
> for BlueCarSprite in crash:
> redracersprites26.BlueCarSprite.collide(crash, playerCar)
> for GreenCarSprite in crash:
> redracersprites26.GreenCarSprite.collide(crash, playerCar)
> for Tr
And it works! Thank you once again to both Steven and Ramit for your
peerless insight into the workings of Python and for taking time out of you
day to help me work my code back to Python 2. I have learned much by talking
with both of you over the last day or so.
Greg
_
Greg Nielsen wrote:
if isinstance(car, redracersprites26.BlueCarSprite()):
TypeError: isinstance() arg 2 must be a class, type, or tuple of classes and
types
Don't instantiate the class. Instead of
redracersprites26.BlueCarSprite() # makes a new instance
just refer to the class object w
: Monday, April 25, 2011 3:19 PM
To: Prasad, Ramit
Cc: Steven D'Aprano; tutor@python.org
Subject: Re: [Tutor] Unbound Method Error
Ramit,
First, thank you for your input and insight into my problem, I believe
that the code you came up with should not only be more efficient, but also
cle
Ramit,
First, thank you for your input and insight into my problem, I believe
that the code you came up with should not only be more efficient, but also
clear up the last of my issues. I just have a quick question on the
isinstance command you called. How exactly do I get the code to recogniz
ain Street | Houston, TX 77002
work phone: 713 - 216 - 5423
From: tutor-bounces+ramit.prasad=jpmchase@python.org
[mailto:tutor-bounces+ramit.prasad=jpmchase@python.org] On Behalf Of Greg
Nielsen
Sent: Monday, April 25, 2011 4:37 AM
To: Steven D'Aprano
Cc: tutor@python.org
Subject: Re:
First and foremost, thank you Steven for your quick and well written
response. It means a lot to me that you took the time out of your day to
answer my question, and it has really helped me better understand what it
going on.
So the full trace back for my error is as follows:
Traceback (most rece
Greg Nielsen wrote:
In Python 2.6.6, this section of code returns the following error
TypeError: unbound method collide() must be called with BlueCarSprite
instance as first argument (got GreenCarSprite instance instead)
Please copy and paste the actual traceback, as that will show the
*actu
Because of the limited Python 3 support, I've decided to attempt to push my
over 600 lines of code back to Python 2.6. Surprisingly, it worked well for
the most part, except for the following section of code.
crash = pygame.sprite.spritecollide(playerCar, computerSprites, False)
if crash: