[lxml-dev] should _setElementValue add type attributes?

Stefan Behnel stefan_ml at behnel.de
Mon Aug 27 19:49:38 CEST 2007


jholg at gmx.de wrote:
>>>> root = objectify.Element("root")
>>>> root.x = "3"
> behave differently from
>>>> root = objectify.fromstring("""<root><x>3</x></root>""")
> 
> Kind of losing sort of a symmetry.

What bothers me more (and where I do see a symmetry) is:

   >>> root = objectify.fromstring("<root><flag>true</flag></root>")

   >>> # now
   >>> root.flag
   True
   >>> root.flag = "true"
   >>> root.flag
   True

   >>> # then
   >>> root.flag
   True
   >>> root.flag = "true"
   >>> root.flag
   'true'

I'm not sure what to think about that. It would be wrong to special case it,
but it kinda feels wrong the way it would work in the future...

Stefan


More information about the lxml-dev mailing list