[GRASS-dev] r.unpack: unhelpful error message when projection info does not match

Glynn Clements glynn at gclements.plus.com
Fri Feb 28 21:21:53 PST 2014


Luca Delucchi wrote:

> I would like to add at line 913 this:
> 
> if dict_a.keys() != dict_b.keys():
>     return False

The ordering of the elements in the list returned by .keys() isn't
defined. E.g. for some dictionary d,

	d.keys() == d.copy().keys()

can be (and typically is) False.

Convert the keys to sets, i.e.

	if set(dict_a.iterkeys()) == set(dict_b.iterkeys()):
	    return False

Or sort them; I'm not sure which is faster overall.

Aside from that, I don't think that compare_key_value_text_files()
(and the functions it uses) belongs in grass.script.core; they're too
specialised. Likewise for create_location().

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list