[lxml-dev] [objectify] Typed E-factory for objectify, PT DataElement()-wrapper
jholg at gmx.de
jholg at gmx.de
Wed Jul 11 15:45:39 CEST 2007
Hi,
attached patch (against trunk)
* 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"
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.
I'd really like to see the PT() function go into the 1.3 series, too.
Please take a look, I can come up with some documentation if you like it.
Holger
--
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tfactory_pt_nonetype.patch
Type: application/octet-stream
Size: 23331 bytes
Desc: not available
Url : http://codespeak.net/pipermail/lxml-dev/attachments/20070711/02980d26/attachment-0001.obj
More information about the lxml-dev
mailing list