<br><br><div class="gmail_quote">On Thu, Aug 6, 2009 at 5:50 PM, Xavier Ho <span dir="ltr"><<a href="mailto:contact@xavierho.com">contact@xavierho.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Thu, Aug 6, 2009 at 11:01 AM, Tennessee Leeuwenburg <span dir="ltr"><<a href="mailto:tleeuwenburg@gmail.com" target="_blank">tleeuwenburg@gmail.com</a>></span> wrote:<br></div><div class="gmail_quote">
<div class="im"><blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
this could be nicer than prefixing things with is, and makes things clearer in some cases, e.g.<br><br>def shouldSomethingHappenFlag(self, context):<br>   if 'relevant' in context:<br>     return True<br><br>   return False<br>


<br>vs <br><br>def shouldSomethingHappen?(self, context):<br>  if 'relevant' in context:<br>    return True<br>  return False<br><br>I just think it looks nicer, and is a good hint that a true/false or other kind of flag is likely to come back.<br>


</blockquote></div><div><br>What about<br><br>hasSomethingHappened(self, context)<br><br>or<br><br>isRelevant(self, context)<br><br>Either way.. I think ? has better uses though. </div></div></blockquote><div><br></div><div>
Well, probably everyone will want to do things differently. Not all method names work with an 'is' stuck on the front, or a 'Flag' stuck on the end... I'm trying out an idiom of ending True/False returners with 'Q', i.e. self.isSomethingTheCaseQ() or self.shouldSomethingHappenQ() or self.getSomeFlagQ()... I find that's reasonably aesthetically pleasing, and is a good hint about what the method is for. </div>
<div><br></div><div>Also, when working with someone else's code, they may already has isFoo() style methods which don't return flags.</div><div><br></div><div>So Q is good enough for me, but ? would be even better, for me.</div>
<div><br></div><div>Cheers,</div><div>-T</div></div>