Re: Spot the invalid syntax

2018-03-08 Thread Steven D'Aprano
On Fri, 09 Mar 2018 00:47:21 +, MRAB wrote: > On 2018-03-08 23:57, Ben Finney wrote: >> You mean the tool is not always looking for mistakes while you type? [...] >> Certainly it'd be good to always have a *perfect* overseer checking for >> mistakes . Until that happy day, though, let's use

Re: Spot the invalid syntax

2018-03-08 Thread MRAB
On 2018-03-08 23:57, Ben Finney wrote: Chris Angelico writes: On Fri, Mar 9, 2018 at 10:33 AM, Ben Finney wrote: > In many cases, those eyes can be virtual and non-human. > > That's what syntax highlighting, and tools even more impressive > (e.g.

Re: Spot the invalid syntax

2018-03-08 Thread Ian Pilcher
On 03/08/2018 05:30 PM, Ben Finney wrote: Not sufficiently, it seems. Check the line preceding the ‘return’ statement. Indeed. :-/ Then, switch to using a programmer's text editor (I prefer Emacs) that can spot these syntax errors while you type. The sad thing is that I am. Just too

Re: Spot the invalid syntax

2018-03-08 Thread Ian Pilcher
On 03/08/2018 05:26 PM, Chris Angelico wrote: On Fri, Mar 9, 2018 at 10:23 AM, Ian Pilcher wrote: (Because I certainly can't.) ips.update(_san_dnsname_ips(cname, True) return ips I've checked for tabs and mismatched parentheses. Check the

Re: Spot the invalid syntax

2018-03-08 Thread Bob van der Poel
On Thu, Mar 8, 2018 at 4:23 PM, Ian Pilcher wrote: > (Because I certainly can't.) > > def _san_dnsname_ips(dnsname, dnsname_is_cname=False): >> """ >> Returns a set of IP addresses, managed by this IPa instance, >> that correspond to the DNS name (from the

Re: Spot the invalid syntax

2018-03-08 Thread Terry Reedy
On 3/8/2018 6:30 PM, Ben Finney wrote: Ian Pilcher writes: ips.update(_san_dnsname_ips(cname, True) | <= auto-indent If you type this code line in IDLE or other decent Python-aware code editor, the smart indent would put

Re: Spot the invalid syntax

2018-03-08 Thread MRAB
On 2018-03-08 23:23, Ian Pilcher wrote: (Because I certainly can't.) def _san_dnsname_ips(dnsname, dnsname_is_cname=False): """ Returns a set of IP addresses, managed by this IPa instance, that correspond to the DNS name (from the subjectAltName). """ fqdn =

Re: Spot the invalid syntax

2018-03-08 Thread Chris Angelico
On Fri, Mar 9, 2018 at 10:57 AM, Ben Finney wrote: > Chris Angelico writes: > >> On Fri, Mar 9, 2018 at 10:33 AM, Ben Finney >> wrote: >> > In many cases, those eyes can be virtual and non-human. >> > >> > That's what

Re: Spot the invalid syntax

2018-03-08 Thread Ben Finney
Chris Angelico writes: > On Fri, Mar 9, 2018 at 10:33 AM, Ben Finney > wrote: > > In many cases, those eyes can be virtual and non-human. > > > > That's what syntax highlighting, and tools even more impressive > > (e.g. linting tools that run

Re: Spot the invalid syntax

2018-03-08 Thread Chris Angelico
On Fri, Mar 9, 2018 at 10:33 AM, Ben Finney wrote: > Chris Angelico writes: > >> (Sometimes, you just need another pair of eyes.) > > In many cases, those eyes can be virtual and non-human. > > That's what syntax highlighting, and tools even more

Re: Spot the invalid syntax

2018-03-08 Thread Ben Finney
Chris Angelico writes: > (Sometimes, you just need another pair of eyes.) In many cases, those eyes can be virtual and non-human. That's what syntax highlighting, and tools even more impressive (e.g. linting tools that run continually), offer in a programmer's text editor: a

Re: Spot the invalid syntax

2018-03-08 Thread Ben Finney
Ian Pilcher 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

Re: Spot the invalid syntax

2018-03-08 Thread Chris Angelico
On Fri, Mar 9, 2018 at 10:23 AM, Ian Pilcher wrote: > (Because I certainly can't.) > >> 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 > ^ >

Spot the invalid syntax

2018-03-08 Thread Ian Pilcher
(Because I certainly can't.) def _san_dnsname_ips(dnsname, dnsname_is_cname=False): """ Returns a set of IP addresses, managed by this IPa instance, that correspond to the DNS name (from the subjectAltName). """ fqdn = dnsutil.DNSName(dnsname).make_absolute() if