Spot the invalid syntax

Ben Finney ben+python at benfinney.id.au
Thu Mar 8 18:30:51 EST 2018


Ian Pilcher <arequipeno at gmail.com> writes:

> >                 ips.update(_san_dnsname_ips(cname, True)
> >     return ips
>
> 2.7 and 3.6 are both giving me:
>
>   File "/tmp/test.py", line 32
>     return ips
>          ^
> SyntaxError: invalid syntax
>
> I've checked for tabs and mismatched parentheses.

Not sufficiently, it seems. Check the line preceding the ‘return’
statement.

Then, switch to using a programmer's text editor (I prefer Emacs) that
can spot these syntax errors while you type.

-- 
 \     “Nothing worth saying is inoffensive to everyone. Nothing worth |
  `\    saying will fail to make you enemies. And nothing worth saying |
_o__)            will not produce a confrontation.” —Johann Hari, 2011 |
Ben Finney




More information about the Python-list mailing list