jholg@gmx.de wrote:
I discussed this with Stefan before and I'm anxious to know if this is the way to go (maybe as switchable behaviour), removing the need for a beast like the discussed PT() factory, as well as making type behaviour arguably more "straightforward", at the cost of auto-adding py:pytype attributes: [_setElementValue implementation that auto-adds type(RVAL).__name__ as py:pytype] I'm +1 for that.
Actually, you were the one who proposed it in the first place, so there's nothing to add to. :)
By making it switchable we could cater for those who don't care about the types that much but who do not want to see any non-explicitly created attributes.
I dislike the idea of adding a switch here. We already add pytype attributes in a couple of places, so people who do not like it will have to deannotate() their XML anyway (or not use objectify...). I think that always adding a pytype will give us more predictable behaviour. On the other hand, we could just check if the pytype the type inference mechanism returns is the type of the value, and only add the attribute if that is not the case. What do you think? It would not work if you exchange annotated data with other machines that use different setups, but if you do that, you'd probably annotate everything by hand anyway. Stefan