[Tutor] problem with program
Alan Gauld
alan.gauld at yahoo.co.uk
Fri Oct 13 19:27:35 EDT 2017
On 13/10/17 18:53, Alan Gauld via Tutor wrote:
> On 13/10/17 13:04, Chris Coleman wrote:
>
>> def_init_(self,chat):
>
>> File "scripts/bird.py", line 4
>> def_init_(self,chat):
>> ^
>> SyntaxError: invalid syntax
>
> There are two problems here.
I meant to add that the syntax error is the colon
at the end. Python sees what you've written as a
function call but it doesn't know what to do
with the colon.
But if you add the space it sees it as a method
definition and all is well.
And once you add the second underscores it then
recognises it as a dunder method definition and
all is even better. :-)
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
More information about the Tutor
mailing list