Aviv Palivoda added the comment:

I have two use cases for this feature:
1.

struct a {
    int a;
#ifdef VER2
    unsigned int b;
#endif
}

Now I may do:
>>> ver1 = Struct("i")
>>> ver2 = ver1 + Struct("I")

2.

struct a {
    int a;
    union inner {
        int b;
        unsigned int c;
    } u;
}

As you can see with this feature I may do:
>>> start = Struct("i")
>>> union_b = Struct("i")
>>> union_c = Struct("I")
>>> version_a = start + union_b
>>> version_b = start + union_c

If you have a big struct with many options in the union this save's copying the 
initial format.

> As for the concrete implementation, it looks to me that Struct('2L') + 
> Struct('25B') results to Struct('2L5B').

I will fix the case when there is no format provided.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29903>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to