Cameron Pulsford a écrit :
Thanks, that did it! Why is that the case though? Or rather, why do the
assignments to temp.x and temp.y not effect the self.x and self.y? How
come I only run into the problem with the list?
Because there's a huge difference between binding an object to a name
and
On Thu, 12 Feb 2009 22:29:29 -, Cameron Pulsford
wrote:
Thanks, that did it! Why is that the case though? Or rather, why do the
assignments to temp.x and temp.y not effect the self.x and self.y? How
come I only run into the problem with the list?
Variable names and assignment don't w
the official answer to that question is here -
http://docs.python.org/reference/datamodel.html?highlight=containers - at
about the 6th paragraph where it talks about "containers".
i think it's a hard question and really in a sense (imho) the real reason
is just that this tends to be the best comp
Thanks, that did it! Why is that the case though? Or rather, why do
the assignments to temp.x and temp.y not effect the self.x and self.y?
How come I only run into the problem with the list?
On Feb 12, 2009, at 5:15 PM, andrew cooke wrote:
you're setting the new knight's "sl" to the value
you're setting the new knight's "sl" to the value self.sl and then adding
values to it. that's the same list - so you are adding values to the
self.sl list when you add them to the knight's sl.
this is easier to understand just by seeing the fix, which is to use:
temp = Knight(self.x, self.y, s
On Thu, Feb 12, 2009 at 1:57 PM, dlocpuwons wrote:
> Using Python 2.6.1...
>
> I am (attempting) to make an A* search for a chess problem, but I am
> running into a really annoying shared memory issue in my successor
> function. Here it is stripped down to the important parts that relate
> to my p