Python None in Fish

Hi everyone!

I would have a small request: would it be possible to have a Fish binding to Python None?

As of 3DEC v7.00.157, Python None converts to Fish vector3 (0.,0.,0.) while (0.,0.,0.) gives an itasca.vec3 in return.
It would be great to have an actual bijection to avoid troubles when converting back from Fish to Python

The closest thing to None singleton I could think of is Fish null pointer.
To date, trying to get null using itasca.fish.get raises an error in Python.

I am not sure it is easily feasible, or if using null is relevant.
Anyway, thanks for your answer!

Regards,

Théophile

Hi,

There is a bug here.I agree that Python None should convert to a null pointer not vector(0,0,0).

Then you can use exception to get a null pointer. For example

import itasca as it 
try:
    x = it.fish.get("x")
except SystemError:
    x = None

Well, it’s just a hack. We need to fix it .

Hi @Huy , thanks for your answer!

The hack does the trick indeed.
An actual binding would be great.
For exemple, we’re working on a module where we link Python functions to Fish functions and a true binding would help having a proper linking.

Anyway, thanks for the hint!

Théophile

Hi @Huy !

By chance, is there any plan to integrate this feature in a next 3DEC update?

Thanks !

Cheers

Théophile

I’ll put in the development list.

Great, thanks a lot!