[lxml-dev] [objectify] Typed E-factory for objectify, PT DataElement()-wrapper

Stefan Behnel stefan_ml at behnel.de
Wed Jul 25 17:39:38 CEST 2007


Hi Holger,

sorry, I keep pushing non trivial decisions back into the FIFO when I first
see them and the queue was pretty long this time. I already looked at your
patch, but didn't get through it completely. You should really cut down the
size of your patches... :)


jholg at gmx.de wrote:
> * adds a typed E-factory (called T-factory)
> * inserts NoneType into the E-factory/T-factory typemap
> * adds the PT() (="PyTyped(<arg>)) convenience function that is a thin wrapper uses the argument value's type to set the pytype
> * provides unittests for E-factory, T-factory and PT()
> * fixes DataElement() to care for some previously-unhandled corner cases concerning None and/or _pytype "none"

I'll take another look at the patch.


> Despite of what I previously said ;-) I now think it would be better to
> rename "none" to "NoneType", to use the same name as the Python builtin
> original. While it is a longer name I seriously doubt you need to actually use
> it explicitly very often.
> By convention, the PyType name should match the Python builtin type name;
> then both the T-factory and the PT() function can work smoothly (the only
> thing special-cased is the Python type name "unicode" with gets substituted by
> "str").
>
> Therefore, the patch also changes "none" to "NoneType" in objectify and the objectify tests/doctests.

This will break existing documents, though, if they do not additionally use
xsi:nil. No idea how many there are...

We could accept both names for the time being, though, and write out the new
one in 2.0 and the old one in 1.3.

Stefan


More information about the lxml-dev mailing list