object has no attribute 'ecrire'

Chris Angelico rosuav at gmail.com
Wed Dec 24 04:26:28 EST 2014


On Wed, Dec 24, 2014 at 7:49 PM,  <fulgar36 at gmail.com> wrote:
> Thank for your answer Chris.
>  I'm a newbie and I just start to learn what is a class and attributes. But when I read your tex I restart the shell and I create a new object and it works.
> Your message helps me and I think I create the object tab with self surface and then I modified my TableauNoir Class . But I did not know that an object could be old but it sounds very logical when you heard it.
> Anyway I think your crystal ball works well ...:-)
>
> P.S : sorry for my english. I'm french.....

Your English is better than my French, which is currently at the level
of "watch Let It Go with subtitles and have an approximate idea of
what she's singing". :)

In Python, "class TableauNoir:" isn't a declaration, it's an
executable statement. It's effectively the same as:

TableauNoir = type(blah blah blah)

where the "blah blah blah" part is a complete representation of the
block of code inside the class statement. When you instantiate it,
like:

foo = TableauNoir()

you create an object of that particular class. Redefining the class
later doesn't change that object, but it will mean that any new
objects you make will use the new class.

Hope that helps!

ChrisA



More information about the Python-list mailing list