[lxml-dev] objectify factories

jholg at gmx.de jholg at gmx.de
Thu Aug 30 16:27:30 CEST 2007


 
> Given the current behaviour of _setElementValue(), I'd say it should just
> go
> and annotate everything it produces.

Meaning an additional TypedElementMaker, right? I think it is actually nice to have the not-annotating ElementMaker as a choice.

> > Also, I think it might make sense to have a PT() factory after all, just
> to
> > add the possibility to hand in attributes:
> > 
> > >>> root.x = 3
> > >>> root.x.set("foo", "bar")
> > >>> # shortcut
> > >>> root.x = PT(3, foo="bar")
> 
> DataElement can add attributes for you.

Yes it does but not the same way. DataElement() always uses the literal of the RVAL to infer the type, if not explicitly given, i.e. it does not make use of the python type of an RVAL. PT() otoh does work just like the new __setattr__/_setElementValue. Maybe modify DataElement() instead of introducing PT(), then?

Holger

-- 
Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kanns mit allen: http://www.gmx.net/de/go/multimessenger


More information about the lxml-dev mailing list