Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Python novice

Name: Anonymous 2011-09-29 17:35


class tic:
  turn = "x"
  def changeturn(self, y = turn):
    if y == "x":
      self.turn = "o"
    if y == "o":
      self.turn = "x"

'''WHY THE FUCK ISN'T this working? The changeturn(), I mean, it only works once!'''

Name: Anonymous 2011-10-01 17:12

>>8
Default parameters are read and evaluated only once, at definition time

Yo homegirl, there is only "compile time" and "run time".

As Python defines changeturn, y is bound to the default value of "x", forever

Not really. Reread the python docs again you jew.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List