Q:

How can I type cast one SWIG-wrapped C struct from one type to another within Python?

I'm using SWIG to make C data structures and functions available to my Python code. I have 2 structures as below - 
struct A {
  .....
};

struct B {
  struct A a;
  ......
};

I call a C function from Python, which returns a (struct A *) b, where b is an instance of struct B.
Can I type cast the pointer from struct A * to struct B * within my Python code?

A:

Yes, but only because the two swig proxies are identical.
There's a layer in between the C objects and the python ones called the proxy layer.

