On Wed, Dec 24, 2014 at 11:42 AM, <fulga...@gmail.com> wrote: > I wrote this code (it was on a book) > > class TableauNoir: > def __init__(self): > self.surface="" > def ecrire(self, message_a_ecrire): > if self.surface != "": > self.surface += "\n" > self.surface+=message_a_ecrire > it does not run on the shell and tells (object TableauNoir has no attribute > 'ecrire'
My crystal ball tells me that there's a lot more code going on here than you've shared with us, and suggests that maybe you had a few tries at this. If you instantiate an object from a "class TableauNoir" and then redefine that class, the object is still of the old class, even though the classes have the same name. You'd need to construct a new object of the new class. ChrisA -- https://mail.python.org/mailman/listinfo/python-list