Suspension error on print (or how to preload simple object columns?)

After @stefano.menci post we wrote something about blocking code and listed the dunders that could and couldn’t suspend

Common dunders that do not support blocking code:

  • __iter__
  • __repr__
  • __str__
  • __bool__
  • Number dunders like __add__, __mul__
  • Comparison dunders like __eq__, __gt__

Common dunders that do support blocking code:

  • __getattr__, __setattr__
  • __getitem__, __setitem__
  • __next__
  • __dir__
  • __init__, __new__
  • __len__
  • __contains__

As to how to preload the simple object - it doesn’t look like that’s getting cached on the client.
We’ll look into that.

I’d suggest converting your __str__ method into a to_json method or something.
Then print(self.to_json())

sidenote: we’ll format the docs so that the bullet points appear correctly!

3 Likes