<?xml version="1.0" encoding="utf-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Steven Caron, OBJ Files, Sexy Bits and Waste</title>
	<atom:link href="http://www.xsi-blog.com/archives/249/feed" rel="self" type="application/rss+xml" />
	<link>http://www.xsi-blog.com/archives/249</link>
	<description>People and thoughts behind XSI in production...</description>
	<pubDate>Sat, 30 Aug 2008 09:12:51 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
		<item>
		<title>By: Andy Nicholas</title>
		<link>http://www.xsi-blog.com/archives/249#comment-17210</link>
		<dc:creator>Andy Nicholas</dc:creator>
		<pubDate>Sun, 23 Mar 2008 11:52:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.xsi-blog.com/archives/249#comment-17210</guid>
		<description>Very interesting link that (for nerds like me anyway). Thanks :-)</description>
		<content:encoded><![CDATA[<p>Very interesting link that (for nerds like me anyway). Thanks :-)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patrick Boucher</title>
		<link>http://www.xsi-blog.com/archives/249#comment-17025</link>
		<dc:creator>Patrick Boucher</dc:creator>
		<pubDate>Mon, 17 Mar 2008 13:46:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.xsi-blog.com/archives/249#comment-17025</guid>
		<description>Stumbled onto this article describing Python optimization this morning.
Thought it was appropriate.

http://www.python.org/doc/essays/list2str.html</description>
		<content:encoded><![CDATA[<p>Stumbled onto this article describing Python optimization this morning.<br />
Thought it was appropriate.</p>
<p><a href="http://www.python.org/doc/essays/list2str.html" onclick="javascript:pageTracker._trackPageview('/outbound/comment/www.python.org');" rel="nofollow">http://www.python.org/doc/essays/list2str.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ciaran Moloney</title>
		<link>http://www.xsi-blog.com/archives/249#comment-16873</link>
		<dc:creator>Ciaran Moloney</dc:creator>
		<pubDate>Sat, 08 Mar 2008 23:56:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.xsi-blog.com/archives/249#comment-16873</guid>
		<description>Thanks, folks!
As a novice scripter, I found this all to be very informative.</description>
		<content:encoded><![CDATA[<p>Thanks, folks!<br />
As a novice scripter, I found this all to be very informative.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bernard Lebel</title>
		<link>http://www.xsi-blog.com/archives/249#comment-16783</link>
		<dc:creator>Bernard Lebel</dc:creator>
		<pubDate>Wed, 05 Mar 2008 16:41:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.xsi-blog.com/archives/249#comment-16783</guid>
		<description>Me again,

I reworked the function a little bit. In bernardFloat(), I change the not ... &#62;= to a simple &#60;.
I also added bernardFloat2(), which does the same thing except creating a temp variable.

&lt;pre lang="python" line="1"&gt;def bernardFloat(version):
    fVersion = float( version[:3] )
    if fVersion &lt; 6.5:
        pass

def bernardFloat2(version):
    if float(version[:3]) &lt; 6.5:
        pass&lt;/pre&gt;


New results:

&lt;pre&gt;Testing with version string '6.0'
----- o -----
steven          0.359300041199
patrick         0.36099998951
andy            0.378199982643
andyNoTempVar   0.454500007629
bernard         0.490700006485
bernardList     0.468799996376
bernardFloat    0.212400007248
bernardFloat2   0.209499979019

Testing with version string '6.5'
----- o -----
steven          0.361100029945
patrick         0.359200000763
andy            0.378199982643
andyNoTempVar   0.459399986267
bernard         0.525099992752
bernardList     0.467100024223
bernardFloat    0.25
bernardFloat2   0.245299983025

Testing with version string '7.0'
----- o -----
steven          0.362500047684
patrick         0.360899996758
andy            0.365499973297
andyNoTempVar   0.363999962807
bernard         0.489200019836
bernardList     0.453099989891
bernardFloat    0.214200091362
bernardFloat2   0.207699918747&lt;/pre&gt;

So skipping the temp variable is even faster!</description>
		<content:encoded><![CDATA[<p>Me again,</p>
<p>I reworked the function a little bit. In bernardFloat(), I change the not &#8230; &gt;= to a simple &lt;.<br />
I also added bernardFloat2(), which does the same thing except creating a temp variable.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="python"><span style="color: #ff7700;font-weight:bold;">def</span> bernardFloat<span style="color: black;">&#40;</span>version<span style="color: black;">&#41;</span>:
    fVersion = <span style="color: #008000;">float</span><span style="color: black;">&#40;</span> version<span style="color: black;">&#91;</span>:<span style="color: #ff4500;">3</span><span style="color: black;">&#93;</span> <span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">if</span> fVersion <span style="color: #66cc66;">&lt;</span> <span style="color: #ff4500;">6.5</span>:
        <span style="color: #ff7700;font-weight:bold;">pass</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> bernardFloat2<span style="color: black;">&#40;</span>version<span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">float</span><span style="color: black;">&#40;</span>version<span style="color: black;">&#91;</span>:<span style="color: #ff4500;">3</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span> <span style="color: #66cc66;">&lt;</span> <span style="color: #ff4500;">6.5</span>:
        <span style="color: #ff7700;font-weight:bold;">pass</span></pre></td></tr></table></div>

<p>New results:</p>
<pre>Testing with version string '6.0'
----- o -----
steven          0.359300041199
patrick         0.36099998951
andy            0.378199982643
andyNoTempVar   0.454500007629
bernard         0.490700006485
bernardList     0.468799996376
bernardFloat    0.212400007248
bernardFloat2   0.209499979019

Testing with version string '6.5'
----- o -----
steven          0.361100029945
patrick         0.359200000763
andy            0.378199982643
andyNoTempVar   0.459399986267
bernard         0.525099992752
bernardList     0.467100024223
bernardFloat    0.25
bernardFloat2   0.245299983025

Testing with version string '7.0'
----- o -----
steven          0.362500047684
patrick         0.360899996758
andy            0.365499973297
andyNoTempVar   0.363999962807
bernard         0.489200019836
bernardList     0.453099989891
bernardFloat    0.214200091362
bernardFloat2   0.207699918747</pre>
<p>So skipping the temp variable is even faster!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bernard Lebel</title>
		<link>http://www.xsi-blog.com/archives/249#comment-16781</link>
		<dc:creator>Bernard Lebel</dc:creator>
		<pubDate>Wed, 05 Mar 2008 16:29:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.xsi-blog.com/archives/249#comment-16781</guid>
		<description>Hey guys, check this out.

I thought that all we were interested in is the version to be 6.5 or more. That's it. The number of digits after the decimal doesn't matter.

So I thought that I could simply take the 3 first characters, convert them to float, and test against that. If the XSI version is ever going to be above 9, it doesn't matter, because at 10 we know for sure we're beyond 6.5.

So wrote this function. No split, no join, no round, no conversion to int, only one comparison.

&lt;pre lang="python" line="1"&gt;def bernardFloat(version):
    fVersion = float( version[:3] )
    if not fVersion &gt;= 6.5:
        pass&lt;/pre&gt;

(let me know if I've overlooked something!)

And then I ran Patrick's test code (although I only did 1,000,000 iterations, as my computer is slower than his). My results:

&lt;pre&gt;Testing with version string '6.0'
----- o -----
steven          0.359000039101
patrick         0.35649998188
andy            0.375
andyNoTempVar   0.453299975395
bernard         0.487199997902
bernardList     0.462599992752
bernardFloat    0.214199995995

Testing with version string '6.5'
----- o -----
patrick         0.357999968529
steven          0.356000041962
andy            0.364100003242
andyNoTempVar   0.359200000763
bernard         0.484500002861
bernardList     0.453199982643
bernardFloat    0.21400001049

Testing with version string '7.0'
----- o -----
steven          0.354699969292
patrick         0.357800030708
andy            0.373399996758
andyNoTempVar   0.453199982643
bernard         0.521800017357
bernardList     0.465700006485
bernardFloat    0.25&lt;/pre&gt;

You'll also notice this entry: bernardList. I wanted to see how things go if I converted the number to integers via a list comprehension:

&lt;pre lang="python" line="1"&gt;def bernardList(version):
    aVersion = [int(sNumber) for sNumber in version.split('.')]
    if (aVersion[0] &lt; 6) or (aVersion[0] == 6 and aVersion[1] &lt; 5):
        pass&lt;/pre&gt;

I love this stuff!

Bernard</description>
		<content:encoded><![CDATA[<p>Hey guys, check this out.</p>
<p>I thought that all we were interested in is the version to be 6.5 or more. That&#8217;s it. The number of digits after the decimal doesn&#8217;t matter.</p>
<p>So I thought that I could simply take the 3 first characters, convert them to float, and test against that. If the XSI version is ever going to be above 9, it doesn&#8217;t matter, because at 10 we know for sure we&#8217;re beyond 6.5.</p>
<p>So wrote this function. No split, no join, no round, no conversion to int, only one comparison.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="python"><span style="color: #ff7700;font-weight:bold;">def</span> bernardFloat<span style="color: black;">&#40;</span>version<span style="color: black;">&#41;</span>:
    fVersion = <span style="color: #008000;">float</span><span style="color: black;">&#40;</span> version<span style="color: black;">&#91;</span>:<span style="color: #ff4500;">3</span><span style="color: black;">&#93;</span> <span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #ff7700;font-weight:bold;">not</span> fVersion <span style="color: #66cc66;">&gt;</span>= <span style="color: #ff4500;">6.5</span>:
        <span style="color: #ff7700;font-weight:bold;">pass</span></pre></td></tr></table></div>

<p>(let me know if I&#8217;ve overlooked something!)</p>
<p>And then I ran Patrick&#8217;s test code (although I only did 1,000,000 iterations, as my computer is slower than his). My results:</p>
<pre>Testing with version string '6.0'
----- o -----
steven          0.359000039101
patrick         0.35649998188
andy            0.375
andyNoTempVar   0.453299975395
bernard         0.487199997902
bernardList     0.462599992752
bernardFloat    0.214199995995

Testing with version string '6.5'
----- o -----
patrick         0.357999968529
steven          0.356000041962
andy            0.364100003242
andyNoTempVar   0.359200000763
bernard         0.484500002861
bernardList     0.453199982643
bernardFloat    0.21400001049

Testing with version string '7.0'
----- o -----
steven          0.354699969292
patrick         0.357800030708
andy            0.373399996758
andyNoTempVar   0.453199982643
bernard         0.521800017357
bernardList     0.465700006485
bernardFloat    0.25</pre>
<p>You&#8217;ll also notice this entry: bernardList. I wanted to see how things go if I converted the number to integers via a list comprehension:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="python"><span style="color: #ff7700;font-weight:bold;">def</span> bernardList<span style="color: black;">&#40;</span>version<span style="color: black;">&#41;</span>:
    aVersion = <span style="color: black;">&#91;</span><span style="color: #008000;">int</span><span style="color: black;">&#40;</span>sNumber<span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">for</span> sNumber <span style="color: #ff7700;font-weight:bold;">in</span> version.<span style="color: black;">split</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'.'</span><span style="color: black;">&#41;</span><span style="color: black;">&#93;</span>
    <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: black;">&#40;</span>aVersion<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span> <span style="color: #66cc66;">&lt;</span> <span style="color: #ff4500;">6</span><span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">or</span> <span style="color: black;">&#40;</span>aVersion<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span> == <span style="color: #ff4500;">6</span> <span style="color: #ff7700;font-weight:bold;">and</span> aVersion<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span> <span style="color: #66cc66;">&lt;</span> <span style="color: #ff4500;">5</span><span style="color: black;">&#41;</span>:
        <span style="color: #ff7700;font-weight:bold;">pass</span></pre></td></tr></table></div>

<p>I love this stuff!</p>
<p>Bernard</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steven Caron</title>
		<link>http://www.xsi-blog.com/archives/249#comment-16750</link>
		<dc:creator>Steven Caron</dc:creator>
		<pubDate>Mon, 03 Mar 2008 22:19:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.xsi-blog.com/archives/249#comment-16750</guid>
		<description>sweet... i was feeling all dumb about my if/else if setup and it runs with acceptable speed.

i do find bernard's harder to read and i dont think i would opt for his code because code maintenance is often shared (your comments go a long way and make up for it) between developers and when i leave the code for a few months and come back i dont want to be scratching my head because i didn't comment :)

fun stuff! true purpose of xsiblog!

s</description>
		<content:encoded><![CDATA[<p>sweet&#8230; i was feeling all dumb about my if/else if setup and it runs with acceptable speed.</p>
<p>i do find bernard&#8217;s harder to read and i dont think i would opt for his code because code maintenance is often shared (your comments go a long way and make up for it) between developers and when i leave the code for a few months and come back i dont want to be scratching my head because i didn&#8217;t comment :)</p>
<p>fun stuff! true purpose of xsiblog!</p>
<p>s</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andy Nicholas</title>
		<link>http://www.xsi-blog.com/archives/249#comment-16749</link>
		<dc:creator>Andy Nicholas</dc:creator>
		<pubDate>Mon, 03 Mar 2008 21:36:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.xsi-blog.com/archives/249#comment-16749</guid>
		<description>I have to say that I like Bernards method for the elegance of the procedure. I think it is a little harder to read and understand at first glance, but that's why he's been good enough to put nice big comments there :-D

Thanks for doing the testing Patrick.</description>
		<content:encoded><![CDATA[<p>I have to say that I like Bernards method for the elegance of the procedure. I think it is a little harder to read and understand at first glance, but that&#8217;s why he&#8217;s been good enough to put nice big comments there :-D</p>
<p>Thanks for doing the testing Patrick.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patrick Boucher</title>
		<link>http://www.xsi-blog.com/archives/249#comment-16740</link>
		<dc:creator>Patrick Boucher</dc:creator>
		<pubDate>Mon, 03 Mar 2008 18:07:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.xsi-blog.com/archives/249#comment-16740</guid>
		<description>Oops.

The &lt;em&gt;andyNoTempVar&lt;/em&gt; function should have read:

&lt;pre lang="python" line="1"&gt;def andyNoTempVar(version):
    tXSIVersion = version.split('.')
    if int(tXSIVersion[0]) &lt; 6 or (int(tXSIVersion[0]) == 6 and int(tXSIVersion[1]) &lt; 5):
        pass&lt;/pre&gt;

I'd forgotten the explicit int conversions. It winds up being slower than the temp variable version in function &lt;em&gt;andy&lt;/em&gt;. So, the temp var version, for having one less conversion creeps ahead in the standings of two tests. New numbers, again with ten million runs:

&lt;pre&gt;Testing with version string '6.0'
---------- o -----------
       steven 1.6405577898
      patrick 1.68582975864
         andy 1.7813429594
andyNoTempVar 2.06077568531
      bernard 2.4824331522


Testing with version string '7.0'
---------- o -----------
       steven 1.62016811371
      patrick 1.56284923553
         andy 1.61941108704
andyNoTempVar 1.53076636791
      bernard 2.48117063046


Testing with version string '6.5'
---------- o -----------
       steven 1.61195776463
      patrick 1.66966564655
         andy 1.77969810963
andyNoTempVar 2.00582532883
      bernard 2.63731787205&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Oops.</p>
<p>The <em>andyNoTempVar</em> function should have read:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="python"><span style="color: #ff7700;font-weight:bold;">def</span> andyNoTempVar<span style="color: black;">&#40;</span>version<span style="color: black;">&#41;</span>:
    tXSIVersion = version.<span style="color: black;">split</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'.'</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">int</span><span style="color: black;">&#40;</span>tXSIVersion<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span> <span style="color: #66cc66;">&lt;</span> <span style="color: #ff4500;">6</span> <span style="color: #ff7700;font-weight:bold;">or</span> <span style="color: black;">&#40;</span><span style="color: #008000;">int</span><span style="color: black;">&#40;</span>tXSIVersion<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span> == <span style="color: #ff4500;">6</span> <span style="color: #ff7700;font-weight:bold;">and</span> <span style="color: #008000;">int</span><span style="color: black;">&#40;</span>tXSIVersion<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span> <span style="color: #66cc66;">&lt;</span> <span style="color: #ff4500;">5</span><span style="color: black;">&#41;</span>:
        <span style="color: #ff7700;font-weight:bold;">pass</span></pre></td></tr></table></div>

<p>I&#8217;d forgotten the explicit int conversions. It winds up being slower than the temp variable version in function <em>andy</em>. So, the temp var version, for having one less conversion creeps ahead in the standings of two tests. New numbers, again with ten million runs:</p>
<pre>Testing with version string '6.0'
---------- o -----------
       steven 1.6405577898
      patrick 1.68582975864
         andy 1.7813429594
andyNoTempVar 2.06077568531
      bernard 2.4824331522

Testing with version string '7.0'
---------- o -----------
       steven 1.62016811371
      patrick 1.56284923553
         andy 1.61941108704
andyNoTempVar 1.53076636791
      bernard 2.48117063046

Testing with version string '6.5'
---------- o -----------
       steven 1.61195776463
      patrick 1.66966564655
         andy 1.77969810963
andyNoTempVar 2.00582532883
      bernard 2.63731787205</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bernard Lebel</title>
		<link>http://www.xsi-blog.com/archives/249#comment-16739</link>
		<dc:creator>Bernard Lebel</dc:creator>
		<pubDate>Mon, 03 Mar 2008 17:35:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.xsi-blog.com/archives/249#comment-16739</guid>
		<description>Nice! Thanks a lot for this!</description>
		<content:encoded><![CDATA[<p>Nice! Thanks a lot for this!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patrick Boucher</title>
		<link>http://www.xsi-blog.com/archives/249#comment-16737</link>
		<dc:creator>Patrick Boucher</dc:creator>
		<pubDate>Mon, 03 Mar 2008 16:37:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.xsi-blog.com/archives/249#comment-16737</guid>
		<description>This is what I used to test. If anyone finds problems with this, please point them out.
Yes, I'm timing a range loop, a function call and variable passing but they are the same in all tests so they kind of cancel out. The time differences we notice are due to the contents of the various functions.

&lt;pre lang="python" line="1"&gt;import time
avgIter = 10
iter = 1000000

def timeit(version, funcs):
    results = dict(zip([f.__name__ for f in funcs], [0.0] * len(funcs)))
    
    for avgi in range(avgIter):
        for func in funcs:
            start = time.time()
            for i in range(iter):
                func(version)
            duration = time.time() - start
            results[func.__name__] += duration
            print '%s - %s: %f' % (func.__name__, version, duration)
    print '----- o -----'
    for k, v in results.iteritems():
        print k, v/avgIter

def steven(version):
    tXSIVersion = version.split('.')
    if int( tXSIVersion[0] ) &lt; 6:
        pass
    else:
        if int( tXSIVersion[1] ) &lt; 5:
            pass

def patrick(version):
    tXSIVersion = version.split('.')
    if int( tXSIVersion[0] ) &lt; 6 or int( tXSIVersion[1] ) &lt; 5:
        pass
    
def andy(version):
    tXSIVersion = version.split('.')
    majorver = int( tXSIVersion[0] )
    minorver = int( tXSIVersion[1] )
    if majorver &lt; 6 or (majorver == 6 and minorver &lt; 5):
        pass

def andyNoTempVar(version):
    tXSIVersion = version.split('.')
    if tXSIVersion[0] &lt; 6 or (tXSIVersion[0] == 6 and tXSIVersion[1] &lt; 5):
        pass
    
def bernard(version):
    # Form version number that includes only the major and minor version numbers
    sVersion = '.'.join( version.split('.')[0:2] )
    # Convert this number to float, round it to 2 digits to be sure
    fVersion = round( float(sVersion), 2 )
    
    if not fVersion &gt;= 6.5:
        pass

if __name__ == '__main__':
    funcs = [steven, patrick, andy, andyNoTempVar, bernard]
    for v in ['6.0', '7.0', '6.5']:
        timeit(v, funcs)&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>This is what I used to test. If anyone finds problems with this, please point them out.<br />
Yes, I&#8217;m timing a range loop, a function call and variable passing but they are the same in all tests so they kind of cancel out. The time differences we notice are due to the contents of the various functions.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
</pre></td><td class="code"><pre class="python"><span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">time</span>
avgIter = <span style="color: #ff4500;">10</span>
<span style="color: #008000;">iter</span> = <span style="color: #ff4500;">1000000</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> <span style="color: #dc143c;">timeit</span><span style="color: black;">&#40;</span>version, funcs<span style="color: black;">&#41;</span>:
    results = <span style="color: #008000;">dict</span><span style="color: black;">&#40;</span><span style="color: #008000;">zip</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span>f.__name__ <span style="color: #ff7700;font-weight:bold;">for</span> f <span style="color: #ff7700;font-weight:bold;">in</span> funcs<span style="color: black;">&#93;</span>, <span style="color: black;">&#91;</span><span style="color: #ff4500;">0.0</span><span style="color: black;">&#93;</span> <span style="color: #66cc66;">*</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>funcs<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">for</span> avgi <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span>avgIter<span style="color: black;">&#41;</span>:
        <span style="color: #ff7700;font-weight:bold;">for</span> func <span style="color: #ff7700;font-weight:bold;">in</span> funcs:
            start = <span style="color: #dc143c;">time</span>.<span style="color: #dc143c;">time</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
            <span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span><span style="color: #008000;">iter</span><span style="color: black;">&#41;</span>:
                func<span style="color: black;">&#40;</span>version<span style="color: black;">&#41;</span>
            duration = <span style="color: #dc143c;">time</span>.<span style="color: #dc143c;">time</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span> - start
            results<span style="color: black;">&#91;</span>func.__name__<span style="color: black;">&#93;</span> += duration
            <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'%s - %s: %f'</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>func.__name__, version, duration<span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'----- o -----'</span>
    <span style="color: #ff7700;font-weight:bold;">for</span> k, v <span style="color: #ff7700;font-weight:bold;">in</span> results.<span style="color: black;">iteritems</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
        <span style="color: #ff7700;font-weight:bold;">print</span> k, v/avgIter
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> steven<span style="color: black;">&#40;</span>version<span style="color: black;">&#41;</span>:
    tXSIVersion = version.<span style="color: black;">split</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'.'</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">int</span><span style="color: black;">&#40;</span> tXSIVersion<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span> <span style="color: black;">&#41;</span> <span style="color: #66cc66;">&lt;</span> <span style="color: #ff4500;">6</span>:
        <span style="color: #ff7700;font-weight:bold;">pass</span>
    <span style="color: #ff7700;font-weight:bold;">else</span>:
        <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">int</span><span style="color: black;">&#40;</span> tXSIVersion<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span> <span style="color: black;">&#41;</span> <span style="color: #66cc66;">&lt;</span> <span style="color: #ff4500;">5</span>:
            <span style="color: #ff7700;font-weight:bold;">pass</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> patrick<span style="color: black;">&#40;</span>version<span style="color: black;">&#41;</span>:
    tXSIVersion = version.<span style="color: black;">split</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'.'</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">int</span><span style="color: black;">&#40;</span> tXSIVersion<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span> <span style="color: black;">&#41;</span> <span style="color: #66cc66;">&lt;</span> <span style="color: #ff4500;">6</span> <span style="color: #ff7700;font-weight:bold;">or</span> <span style="color: #008000;">int</span><span style="color: black;">&#40;</span> tXSIVersion<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span> <span style="color: black;">&#41;</span> <span style="color: #66cc66;">&lt;</span> <span style="color: #ff4500;">5</span>:
        <span style="color: #ff7700;font-weight:bold;">pass</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> andy<span style="color: black;">&#40;</span>version<span style="color: black;">&#41;</span>:
    tXSIVersion = version.<span style="color: black;">split</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'.'</span><span style="color: black;">&#41;</span>
    majorver = <span style="color: #008000;">int</span><span style="color: black;">&#40;</span> tXSIVersion<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span> <span style="color: black;">&#41;</span>
    minorver = <span style="color: #008000;">int</span><span style="color: black;">&#40;</span> tXSIVersion<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span> <span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">if</span> majorver <span style="color: #66cc66;">&lt;</span> <span style="color: #ff4500;">6</span> <span style="color: #ff7700;font-weight:bold;">or</span> <span style="color: black;">&#40;</span>majorver == <span style="color: #ff4500;">6</span> <span style="color: #ff7700;font-weight:bold;">and</span> minorver <span style="color: #66cc66;">&lt;</span> <span style="color: #ff4500;">5</span><span style="color: black;">&#41;</span>:
        <span style="color: #ff7700;font-weight:bold;">pass</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> andyNoTempVar<span style="color: black;">&#40;</span>version<span style="color: black;">&#41;</span>:
    tXSIVersion = version.<span style="color: black;">split</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'.'</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">if</span> tXSIVersion<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span> <span style="color: #66cc66;">&lt;</span> <span style="color: #ff4500;">6</span> <span style="color: #ff7700;font-weight:bold;">or</span> <span style="color: black;">&#40;</span>tXSIVersion<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span> == <span style="color: #ff4500;">6</span> <span style="color: #ff7700;font-weight:bold;">and</span> tXSIVersion<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span> <span style="color: #66cc66;">&lt;</span> <span style="color: #ff4500;">5</span><span style="color: black;">&#41;</span>:
        <span style="color: #ff7700;font-weight:bold;">pass</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> bernard<span style="color: black;">&#40;</span>version<span style="color: black;">&#41;</span>:
    <span style="color: #808080; font-style: italic;"># Form version number that includes only the major and minor version numbers</span>
    sVersion = <span style="color: #483d8b;">'.'</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span> version.<span style="color: black;">split</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'.'</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span>:<span style="color: #ff4500;">2</span><span style="color: black;">&#93;</span> <span style="color: black;">&#41;</span>
    <span style="color: #808080; font-style: italic;"># Convert this number to float, round it to 2 digits to be sure</span>
    fVersion = <span style="color: #008000;">round</span><span style="color: black;">&#40;</span> <span style="color: #008000;">float</span><span style="color: black;">&#40;</span>sVersion<span style="color: black;">&#41;</span>, <span style="color: #ff4500;">2</span> <span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #ff7700;font-weight:bold;">not</span> fVersion <span style="color: #66cc66;">&gt;</span>= <span style="color: #ff4500;">6.5</span>:
        <span style="color: #ff7700;font-weight:bold;">pass</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span> __name__ == <span style="color: #483d8b;">'__main__'</span>:
    funcs = <span style="color: black;">&#91;</span>steven, patrick, andy, andyNoTempVar, bernard<span style="color: black;">&#93;</span>
    <span style="color: #ff7700;font-weight:bold;">for</span> v <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: black;">&#91;</span><span style="color: #483d8b;">'6.0'</span>, <span style="color: #483d8b;">'7.0'</span>, <span style="color: #483d8b;">'6.5'</span><span style="color: black;">&#93;</span>:
        <span style="color: #dc143c;">timeit</span><span style="color: black;">&#40;</span>v, funcs<span style="color: black;">&#41;</span></pre></td></tr></table></div>

]]></content:encoded>
	</item>
</channel>
</rss>
