[Tutor] FW: FW: robots question

Roelof Wobben rwobben at hotmail.com
Thu Sep 16 20:22:57 CEST 2010




----------------------------------------
> From: rwobben at hotmail.com
> To: __peter__ at web.de
> Subject: RE: [Tutor] FW: robots question
> Date: Thu, 16 Sep 2010 18:22:03 +0000
>
>
>
>
> ----------------------------------------
>> To: tutor at python.org
>> From: __peter__ at web.de
>> Date: Thu, 16 Sep 2010 20:10:02 +0200
>> Subject: Re: [Tutor] FW: robots question
>>
>> Roelof Wobben wrote:
>>
>>> I change everything to this :
>>
>>> def check_collisions(robots, junk, player):
>>
>>> defeated = check_collisions(robots, player, junk)
>>
>> Do you see the problem?
>
>

yes, Player en junk are swapped.

>
>
>>
>>> print "type robots", type(robots)
>>> print "type junk", type(junk)
>>> print "type player", type(player)
>>
>> Adding print statements for debugging purposes is a good approach.
>>
>>> And now Im getting this message :
>>>
>>> ** Message: pygobject_register_sinkfunc is deprecated (GtkWindow)
>>> ** Message: pygobject_register_sinkfunc is deprecated (GtkInvisible)
>>> ** Message: pygobject_register_sinkfunc is deprecated (GtkObject)
>>>
>>> type robotsTraceback (most recent call last):
>>>
>>> type junk
>>> type player
>>> File "/root/workspace/test2/src/test.py", line 125, in
>>> play_game()
>>> File "/root/workspace/test2/src/test.py", line 111, in play_game
>>> defeated = check_collisions(robots, player, junk)
>>> File "/root/workspace/test2/src/test.py", line 74, in check_collisions
>>> for thing in robots + junk:
>>> TypeError: can only concatenate list (not "dict") to list
>>>
>>> So far I can see the problem is that player is a dict and the rest is a
>>> list.
>>> Is this the correct conclusion ?
>>
>> It may be correct but it's a low-level view. A more appropriate description
>> would be that you are trying to concatenate a list of robots with a player.
>

Oke,

 I will try to make one list which will contain the robots and a player.
 
 

>>
>> Peter
>>
>> _______________________________________________
>> Tutor maillist - Tutor at python.org
>> To unsubscribe or change subscription options:
>> http://mail.python.org/mailman/listinfo/tutor 		 	   		  


More information about the Tutor mailing list