RDFLib/rdflib — Issue #32: Literal repr mishandles the input kw arg names
Author: gjhiggins
Created: 2012-02-20 08:30:55+00:00
State: closed

drewpca, 2008-12-19T06:42:14.000Z

>>> Literal('2008-12-18',
datatype=URIRef('http://www.w3.org/2001/XMLSchema#date'))
rdflib.Literal('2008-12-18', language=None,
datatype=rdflib.URIRef('http://www.w3.org/2001/XMLSchema#date'))

The language=None part isn't wrong, but it does make my doctest lines extra
long.

>>> Literal('bonjour', lang='fr')
rdflib.Literal('bonjour', language='fr', datatype=None)

That one is much worse, because the repr does not eval back to the object
(lang vs language). Similarly, I wish it would omit the datatype=None.

Comment 1 by drewpca

Comment 2 by eik...@gmail.com
Literal's __repr__ was changed from language to lang in r1139; which is now consistent with the __init__ method.
The __repr__ no longer includes lang or datatype if they are None. See r1470.