<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Dec 16, 2013 at 7:49 AM, Paul Wilson <span dir="ltr"><<a href="mailto:wilsonp@engr.wisc.edu" target="_blank">wilsonp@engr.wisc.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
Hi Andy, Iulian,<br>
<br>
I've added Anthony Scopatz into this conversation, as he has a
growing interest in PyTAPS. He is also a python expert. I'm not
sure if he is on the CGMA list yet.<br></div></blockquote><div><br></div><div>Hello All, </div><div><br></div><div>I didn't know there was a cgma-dev list :) I have applied now.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF"><nudge>Tim was also planning to move it to bitbucket soon
(last month?) to facilitate collaborative development </nudge><br></div></blockquote><div><br></div><div><doublenudge /></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF"><br>
<div>On 12/13/2013 12:22 PM, Iulian
Grindeanu wrote:<br>
</div>
<blockquote type="cite">
<div style="font-size:12pt;font-family:'times new roman','new york',times,serif">It looks like in python there
is no equivalent to ifdefs. <br></div></blockquote></div></blockquote><div>It isn't entirely clear to me what you are trying to ifdef around here. The code here was for the OS but Andy was mentioning code version. Still, I would say that the ifdef concept doesn't exactly apply. In Python, the API should be the same across all platforms and the implementation should vary based on the system you are on. Think of this kind of a environment-based duck typing :). It is much more normal in Python to write something like the following:</div>
<div><br></div><div><font face="courier new, monospace">import os</font></div><div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">def foo(x):</font></div><div><font face="courier new, monospace"> if <a href="http://os.name">os.name</a> == 'posix':</font></div>
<div><font face="courier new, monospace"> rtn = x * x</font></div><div><font face="courier new, monospace"> else:</font></div><div><font face="courier new, monospace"> rtn = x + 42</font></div><div><font face="courier new, monospace"> return rtn</font></div>
<div><br></div><div>This is different than the version written by Iulian because you are guaranteed the same foo() object no matter where you are. If you are going to be doing this comparison a lot it might behoove you to bank the result globally.</div>
<div><br></div><div><div><font face="courier new, monospace">import os</font></div><div><span style="font-family:'courier new',monospace">ON_POSIX = <a href="http://os.name">os.name</a> == 'posix'</span><font face="courier new, monospace"><br>
</font></div><div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">def foo(x):</font></div><div><font face="courier new, monospace"> if ON_POSIX:</font></div><div><font face="courier new, monospace"> rtn = x * x</font></div>
<div><font face="courier new, monospace"> else:</font></div><div><font face="courier new, monospace"> rtn = x + 42</font></div><div><font face="courier new, monospace"> return rtn</font></div></div><div><br>
</div>
<div>Hope this helps!</div><div>Be Well</div><div>Anthony</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF"><blockquote type="cite"><div style="font-size:12pt;font-family:'times new roman','new york',times,serif">
We could simply use an if statement, but we need to have
something different for cgm >= 13<br>
Python is an interpreted language, and we can do something like
this:<br>
<pre><code><span>import</span><span> os
</span><span>if</span><span> os</span><span>.</span><span>name </span><span>==</span><span> </span><span>"posix"</span><span>:</span><span>
</span><span>def</span><span> foo</span><span>(</span><span>x</span><span>):</span><span>
</span><span>return</span><span> x </span><span>*</span><span> x
</span><span>else</span><span>:</span><span>
</span><span>def</span><span> foo</span><span>(</span><span>x</span><span>):</span><span>
</span><span>return</span><span> x </span><span>+</span><span> </span><span>42
</span></code></pre>
Now, we need to export somehow the version from iGeom.h /
iBase.h, to be visible in pytaps.<br>
<br>
Another solution is to create an svn branch for pytaps too (I
prefer not to, because there is not much difference, so far) And
as long as iGeom.h does not change, we do not really need
different branches.<br>
<br>
Any suggestions?<br>
<br>
Iulian<br>
<br>
<hr>
<blockquote style="padding-left:5px;font-size:12pt;font-style:normal;margin-left:5px;font-family:Helvetica,Arial,sans-serif;text-decoration:none;font-weight:normal;border-left-width:2px;border-left-style:solid;border-left-color:rgb(16,16,255)">
<div style="font-size:12pt;font-family:'times new roman','new york',times,serif">Hello,<br>
Does anybody know how to do ifdefs in python? Or something
similar? <br>
This is what I am using for pytaps built with cgm trunk
(actually, cgm/tags/13.1.1)<br>
(you should be able to apply this patch on pytaps source,
and use it also for trunk version)<br>
<br>
Iulian<br>
<hr>
<blockquote style="padding-left:5px;font-size:12pt;font-style:normal;margin-left:5px;font-family:Helvetica,Arial,sans-serif;text-decoration:none;font-weight:normal;border-left-width:2px;border-left-style:solid;border-left-color:rgb(16,16,255)">
HI<br>
<br>
I think the iMesh implmentation in CGM13.1 is mismatched
for the PyTAPS <br>
1.4, PyTAPS 1.4 failed to build when using CGM 13.1, but
is fine with <br>
12.2. The error messages are all code issues regarding
mismatched <br>
arguments to functions, passing ints when it should be
doubles and so on.<br>
<br>
I figured this should be reported here since I couldnt
find PyTAPS dev<br>
<br>
Thanks<br>
<br>
Andy<br>
<br>
</blockquote>
<br>
</div>
</blockquote>
<br><span><font color="#888888">
</font></span></div><span><font color="#888888">
</font></span></blockquote><span><font color="#888888">
<br>
<pre cols="72">--
-- ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ --
Paul Wilson ~ UW-Madison ~ <a href="tel:608-263-0807" value="+16082630807" target="_blank">608-263-0807</a> ~ cal: <a href="http://bit.ly/pphw-cal" target="_blank">http://bit.ly/pphw-cal</a>
Professor, Engineering Physics. ~ <a href="http://cnerg.engr.wisc.edu" target="_blank">http://cnerg.engr.wisc.edu</a>
Faculty Director, Advanced Computing Infrastructure</pre>
</font></span></div>
</blockquote></div><br></div></div>