<div dir="ltr">The appended email crossed the transom at <a href="mailto:webmaster@python.org">webmaster@python.org</a> today. Apologies for the hot mess Gmail makes of forwarded emails.<div><br></div><div>I wonder if it makes sense to warn about misspelled dunder names. I tried pylinting (1.1.0, sorry, it's what I have here at work) and flake8ing (2.0) this:<div><br></div><div><div>class Foo(object):</div><div>    def __init_(self):</div><div>        self.x = 0</div><div><br></div><div>    def _add_(self, other):</div><div>        return self.x + other.x</div><div><br></div><div>Pylint complained about attribute x not being defined in __init__, but that's a rather indirect message. It failed to say anything about _add_. Flake8 said nothing.</div><div><br></div><div>Is this a common enough problem that these sort of tools should warn about mistakes in the leading/trailing underscore count of otherwise dunder attributes?</div><div><br></div><div>Skip</div><div><br></div><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">protestmailself</b> <span dir="ltr"><<a href="mailto:protestmailself@gmail.com">protestmailself@gmail.com</a>></span><br>Date: Fri, Nov 21, 2014 at 1:56 AM<br>Subject: Re: The doc demo have some problems<br>To: webmaster <<a href="mailto:webmaster@python.org">webmaster@python.org</a>><br><br><br><div>
<div><span></span>Hi:</div><div><br></div><div>     I make a mistake using </div><div>       <span style="font-size:10.5pt;line-height:1.5;background-color:rgb(153,204,0)">_init_</span><span style="font-size:10.5pt;line-height:1.5;background-color:rgb(255,255,255)">  not the </span><span style="font-size:10.5pt;line-height:1.5;background-color:rgb(153,204,0)">__init__</span></div>
<div><br></div><hr style="width:210px;min-height:1px" color="#b5c4df" size="1" align="left">
<div><span>protestmailself</span></div>
<blockquote style="margin-top:0px;margin-bottom:0px;margin-left:0.5em"><div> </div><div style="border-style:solid none none;border-top-color:rgb(181,196,223);border-top-width:1pt;padding:3pt 0cm 0cm"><div style="padding:8px;font-size:12px;font-family:tahoma;color:rgb(0,0,0);background:rgb(239,239,239)"><div><b>From:</b> <a href="mailto:protestmailself@gmail.com" target="_blank">protestmailself</a></div><div><b>Date:</b> 2014-11-21 15:30</div><div><b>To:</b> <a href="mailto:webmaster@python.org" target="_blank">webmaster</a></div><div><b>Subject:</b> The doc demo have some problems</div></div></div><div><div class="h5"><div><div>
<u></u><u></u>
<div>
<div><span style="font-family:'Times New Roman'"></span>Hi:</div>
<div> </div>
<div>    I using the code at location: [<span style="font-family:'';font-size:10.5pt;line-height:1.5;background-color:window"></span><a href="https://docs.python.org/2/tutorial/classes.html%5D" style="font-family:'';font-size:10.5pt;line-height:1.5;background-color:window" target="_blank">https://docs.python.org/2/tutorial/classes.html]</a><span style="font-family:'';font-size:10.5pt;line-height:1.5;background-color:window"> using python 2.7.8</span></div><span></span><div>    <span style="background-color:rgb(153,204,0)">  <span style="font-size:10.5pt;line-height:1.5">class Complex:</span></span></div></div><blockquote style="margin:0px 0px 0px 0.5em;border:none;padding:0px"><div><p style="margin:0px"><span style="background-color:rgb(153,204,0)">    def _init_(self, realpart, imagpart):</span></p></div><div><p style="margin:0px"><span style="background-color:rgb(153,204,0)">        self.r = realpart</span></p></div><div><p style="margin:0px"><span style="background-color:rgb(153,204,0)">        self.i = imagpart</span></p></div></blockquote><span style="font-size:10.5pt;line-height:1.5;background-color:rgb(153,204,0)">      x = Complex(3.0, -4.5)</span><div><span style="background-color:rgb(153,204,0)">      <span style="color:rgb(51,51,51);line-height:15.6000003814697px;font-size:10.5pt">x</span><span style="line-height:15.6000003814697px;font-size:10.5pt;color:rgb(102,102,102)">.</span><span style="color:rgb(51,51,51);line-height:15.6000003814697px;font-size:10.5pt">r</span><span style="color:rgb(51,51,51);line-height:15.6000003814697px;font-size:10.5pt">,</span><span style="color:rgb(51,51,51);line-height:15.6000003814697px;font-size:10.5pt"> </span><span style="color:rgb(51,51,51);line-height:15.6000003814697px;font-size:10.5pt">x</span><span style="line-height:15.6000003814697px;font-size:10.5pt;color:rgb(102,102,102)">.</span><span style="color:rgb(51,51,51);line-height:15.6000003814697px;font-size:10.5pt">i</span></span><div>
<div> </div><div>     I got the error: <span style="font-family:'';font-size:10.5pt;line-height:1.5;background-color:window">TypeError: this constructor takes no arguments</span></div><div><span style="font-family:'';font-size:10.5pt;line-height:1.5;background-color:window">     i think this is a mistake as the demo not define a </span><span style="font-size:10.5pt;line-height:1.5;background-color:window">constructor, but use a </span><span style="font-size:10.5pt;line-height:1.5;background-color:window">constructor</span><span style="font-size:10.5pt;line-height:1.5;background-color:window"> with two </span><span style="font-size:10.5pt;line-height:1.5;background-color:window">arguments.</span></div><div><span style="font-size:10.5pt;line-height:1.5;background-color:window">     Change to this can be passed.</span></div><div><div>    <span style="background-color:rgb(153,204,0)">  <span style="font-size:10.5pt;line-height:1.5">class Complex:</span></span></div><blockquote style="margin:0px 0px 0px 0.5em;border:none;padding:0px"><div><p style="margin:0px"><span style="background-color:rgb(153,204,0)">r = 0</span></p></div><div><p style="margin:0px"><span style="background-color:rgb(153,204,0)">i = 0</span></p></div><div><p style="margin:0px"><span style="background-color:rgb(153,204,0)">def _init_(self, realpart, imagpart):</span></p></div><div><p style="margin:0px"><span style="background-color:rgb(153,204,0)">self.r = realpart</span></p></div><div><p style="margin:0px"><span style="background-color:rgb(153,204,0)">self.i = imagpart</span></p></div></blockquote><p style="margin:0px"><span style="background-color:rgb(153,204,0)">    <font color="#ff0000">x = Complex()</font></span></p>
<p style="margin:0px"><span style="background-color:rgb(153,204,0)"><font color="#ff0000">    x._init_(3.0, -4.5)</font></span></p><div><span style="background-color:rgb(153,204,0)">      <span style="color:rgb(51,51,51);line-height:15.6000003814697px;font-size:10.5pt">x</span><span style="line-height:15.6000003814697px;font-size:10.5pt;color:rgb(102,102,102)">.</span><span style="color:rgb(51,51,51);line-height:15.6000003814697px;font-size:10.5pt">r</span><span style="color:rgb(51,51,51);line-height:15.6000003814697px;font-size:10.5pt">,</span><span style="color:rgb(51,51,51);line-height:15.6000003814697px;font-size:10.5pt"> </span><span style="color:rgb(51,51,51);line-height:15.6000003814697px;font-size:10.5pt">x</span><span style="line-height:15.6000003814697px;font-size:10.5pt;color:rgb(102,102,102)">.</span><span style="color:rgb(51,51,51);line-height:15.6000003814697px;font-size:10.5pt">i</span></span></div></div><div><span style="font-size:10.5pt;line-height:1.5;background-color:window"><br></span></div><div><span style="font-size:10.5pt;line-height:1.5;background-color:window"><br></span></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div>Best regards</div></div>
<hr style="width:210px;min-height:1px" align="left" color="#b5c4df" size="1">
<div><span>protestmailself</span></div>
</div></div></div></div></div></blockquote>
</div></div><br></div></div></div>