<div class="gmail_quote">On Sun, Dec 20, 2009 at 3:26 PM, Stephen Hansen <span dir="ltr"><<a href="mailto:apt.shansen@gmail.com">apt.shansen@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="gmail_quote"><div class="im">On Sun, Dec 20, 2009 at 11:01 AM, Victor Subervi <span dir="ltr"><<a href="mailto:victorsubervi@gmail.com" target="_blank">victorsubervi@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">


<div class="gmail_quote"><div><div></div><div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="gmail_quote"><div>If you want a piece of code to have a variable number of differing behaviors, that's something you can handle in many elegant ways. That's something inheritance is good for, with a core default behavior represented in one class and more specialized behavior represented in sub-classes. But either way, you have to tell it which class to create at the moment, which entails passing in a parameter explicitly activating one or the other. This is a good thing. Don't try to get around it.</div>



</div></blockquote></div></div><div><br>Inelegant. This will be elegant:<br><br>ourFile = string.split(__file__, "/")<br>p = ourFile[len(ourFile) - 1]<br>p = p[: - 3]<br>site = ourFile[4][:-10]<br>if site != '':<br>



  site = site[:-1]<br><br>from this import that(site)<br><br>Now it's automated.<br></div></div></blockquote><div><br></div></div><div>Since when is "automation" a synonym of "elegance"?</div><div>
<br></div>

<div>Granted, elegance is something that will always be in the eye of the beholder-- but looking at that chunk of code, I can't even figure out what you're trying to do with it (or what that last 'from ...' line is even supposed to mean).</div>
</div></blockquote><div><br><sigh><br>It's something to plug into any page anywhere and not have to worry about tweaking it for a given page. Not reading further responses to this post.<br>V<br></div></div><br>