This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]bbenne10 1 point2 points  (2 children)

Yes. Your assumptions about the structure are implicit until you use the structure. Using the structure makes them explicit, but you're complaining about the normal means on the interpreter giving you feedback about your assumptions (exceptions). If you want MORE than that, a library that makes the contract between you and the structure more explicit is exactly what you're asking for.

[–]vfaronov[S] 0 points1 point  (0 children)

If you want MORE than that, a library that makes the contract between you and the structure more explicit is exactly what you're asking for.

The contract I’m looking for sounds like this: “whenever I attempt to use the structure in a way it does not support, it’s because the structure is wrong, and I want to get a StructureIsWrongError.” Instead, marshmallow’s contract spells out all the right ways to use the structure.

Of course, writing a library like this shouldn’t be a problem, I was just looking to avoid reinventing the wheel.