delb-xml / delb-py

A library that provides an ergonomic model for XML encoded text documents (e.g. with TEI-XML).
https://delb.readthedocs.io
GNU Affero General Public License v3.0
16 stars 0 forks source link

Is the insertion order of NodeBase.add_previous the intuitive behavior? #30

Closed funkyfuture closed 2 years ago

funkyfuture commented 2 years ago

currently, when multiple nodes shall be prepended to one, the call

A.add_previous(B, C, D, E)

but also:

siblings = (B, C, D, E)
A.add_previous(*siblings)

results in node siblings ordered like:

E D C B A

whereas this is an alternative:

B C D E A

as far as i remember i chose the current order because it's behaving symmetrically to add_next. but i'm not sure whether that is something that'd be expected.

if there even is an behaviour that can be generally or somehow scoped be asserted as intuitive. with regards to consistency to add_next, both variants can make sense.

the question applies similarly to prepend_child.

funkyfuture commented 2 years ago

that mentioned symmetry is also true in XPath expressions through its concept of forward and reverse axes.