Both AMF0 and AMF3 can contain references to objects so if the participants
of a project were rendered individually, the project object would only be
rendered once and then references would be made to it (2 bytes usually).
Does that help?
When I first read your answer, I thought PyAMF already had support for this feature of AMF. Now I understand that it doesn't, but it could be added. Is that what you mean?
Sorry for not being clear, PyAMF already supports this feature.
I also realize now why the referenced class is being serialized. On Google App Engine, when you use a reference property, it automatically fetches the referenced object and returns it. So PyAMF's standard serialization of GAE object will probably always perform a deep serialization. I wonder if it will have problems with circular references.
This is one of the features that the reference type is designed to support. An example:
x = [1, 2, 3]
y = pyamf.decode(pyamf.encode(x)).next()
assert id(y) == id(y), 'not a circular reference'
Anyway, I was able to implement a pattern for returning DTOs. I explain my approach in this article: