_PluralBinding was added in PyXB 1.2.1 to resolve: https://sourceforge.net/apps/trac/pyxb/ticket/69

Using a list for elements with multiplicity greater than one bypassed PyXB's ability to validate when the containing element added new content.  A more informed container was necessary.

A _PluralBinding instance should support all the methods of a Python list including treating them as iterators, but it doesn't have __add__.  I could add that method, but it would only work for pb+list, not for list+pb, so it'd be fragile.

Best solution is to refactor your code.

On Tue, Feb 18, 2014 at 9:32 AM, Patrick Byrne <pjlbyrne@gmail.com> wrote:

I am attempting to upgrade our system from Pytbon2.6/PyXB-1.1.4 to Python-2.7.4/PyXB-1.2.3. I am seeing a number of errors with our scripts where a PluralBinding class is treated like a list.

this code
    for MuxInput in If.sdr_mux_input + ["default"]:
TypeError: unsupported operand type(s) for +: '_PluralBinding' and 'list'

this code:
    SdrIfs         = Die.sdr_interface      
    MuxedSdrIfs    = Die.muxed_sdr_interface
    DdrIfs         = Die.ddr_interface      
    for If in SdrIfs + MuxedSdrIfs + DdrIfs:
TypeError: unsupported operand type(s) for +: '_PluralBinding' and '_PluralBinding'

Can someone enlighten me as to what is going on here? I see that the _PluralBinding class is trying to behave like a list. It does not appear to be present at all in content.py in PyXB-1.1.4.


Patrick Byrne

Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
pyxb-users mailing list