0

I am using an API for the Plaxis2D program which is based in python. it appears that for one of the material models, they have a method defined as lambda

In [60]: dir(g_i.MCC)
Out[60]: 
[...
 'emin',
 'gammaPore',
 'gammaSat',
 'gammaUnsat',
 'info',
 'kappa',
 'kappaModified',
 'lambda',
 'lambdaModified',
 'materialcommand',
 'multiply',
...]

Naturally when I attempt to call this method I get an error

In [61]: g_i.MCC.lambda
  File "<ipython-input-61-fc4a65285477>", line 1
    g_i.MCC.lambda
                 ^
SyntaxError: invalid syntax

Other methods work fine:

g_i.MCC.kappa
Out[62]: <Object {AED3A25E-014A-4035-B114-0047EE1C748C}>

Of course, it is stupid to have a method be given a name identical to an intrinsic Python function. However I am not sure the API they provide is really their main priority... which leads to situation like this...

How can I circumvent such that I can access this method?

user32882
  • 5,094
  • 5
  • 43
  • 82
  • 1
    You can use `getattr(g_i.MCC, 'lambda')` and avoid having the parser snoop that dot referencing which is followed by a keyword. – Moses Koledoye Oct 09 '17 at 08:59
  • Nice, I had already looked at the other post but it was not clear to me at all. Thanks for your help – user32882 Oct 09 '17 at 09:03

0 Answers0