[cgma-dev] CGM 13.1 and PyTAPS

Anthony Scopatz scopatz at gmail.com
Mon Dec 16 11:23:30 CST 2013


On Mon, Dec 16, 2013 at 7:49 AM, Paul Wilson <wilsonp at engr.wisc.edu> wrote:

>  Hi Andy, Iulian,
>
> 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.
>

Hello All,

I didn't know there was a cgma-dev list :)  I have applied now.


> <nudge>Tim was also planning to move it to bitbucket soon (last month?) to
> facilitate collaborative development </nudge>
>

<doublenudge />


> On 12/13/2013 12:22 PM, Iulian Grindeanu wrote:
>
> It looks like in python there is no equivalent to ifdefs.
>
> 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:

import os

def foo(x):
    if os.name == 'posix':
        rtn = x * x
    else:
        rtn = x + 42
    return rtn

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.

import os
ON_POSIX = os.name == 'posix'

def foo(x):
    if ON_POSIX:
        rtn = x * x
    else:
        rtn = x + 42
    return rtn

Hope this helps!
Be Well
Anthony

>  We could simply use an if statement, but we need to have something
> different for cgm >= 13
> Python is an interpreted language, and we can do something like this:
>
> import os
> if os.name == "posix":
>     def foo(x):
>         return x * xelse:
>     def foo(x):
>         return x + 42
>
>
> Now, we need to export somehow the version from iGeom.h / iBase.h, to be
> visible in pytaps.
>
> 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.
>
>  Any suggestions?
>
> Iulian
>
> ------------------------------
>
> Hello,
> Does anybody know how to do ifdefs in python? Or something similar?
> This is what I am using for pytaps built with cgm trunk (actually,
> cgm/tags/13.1.1)
> (you should be able to apply this patch on pytaps source, and use it also
> for trunk version)
>
> Iulian
> ------------------------------
>
> HI
>
> I think the iMesh implmentation in CGM13.1 is mismatched for the PyTAPS
> 1.4, PyTAPS 1.4 failed to build when using CGM 13.1, but is fine with
> 12.2. The error messages are all code issues regarding mismatched
> arguments to functions, passing ints when it should be doubles and so on.
>
> I figured this should be reported here since I couldnt find PyTAPS dev
>
> Thanks
>
> Andy
>
>
>
>
> --
> -- ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ --
> Paul Wilson ~ UW-Madison ~ 608-263-0807 ~ cal: http://bit.ly/pphw-cal
> Professor, Engineering Physics. ~ http://cnerg.engr.wisc.edu
> Faculty Director, Advanced Computing Infrastructure
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/cgma-dev/attachments/20131216/d4dcade4/attachment.html>


More information about the cgma-dev mailing list