Shibli - 9 months ago 36

Python Question

I have a code which reads unstructured mesh. I wrote wrappers around geometric entities of

`sympy.geometry`

`class Point:`

def __init__(self, x, y, parent_mesh):

self.shape = sympy.geometry.Point(x,y)

self.parent_mesh = parent_mesh

self.parent_cell = list()

Everything works fine but initialization of

`sympy.geometry.Point`

`Point`

`sympy.geometry`

`sympy.geometry`

Answer

Take a look at the `Point`

class documentation, specifically, in one of the first examples:

Floats are automatically converted to Rational unless the evaluate flag is

`False`

.

So, you could pass a flag named `evaluate`

during initialization of your `Point`

classes:

```
self.shape = sympy.geometry.Point(x,y, evaluate=False)
```

which apparently signals what you're after.