openerp-dev-web team mailing list archive
-
openerp-dev-web team
-
Mailing list archive
-
Message #07460
Re: [Merge] lp:~openerp-dev/openobject-client-web/6.0-opw-4834-msh into lp:openobject-client-web/6.0
Did some style fixes before merging:
* the name `datas` is very confusing, renamed to `original_data` to indicate relation
* `Updated_data` has wrong casing, should be `updated_data` (I also dropped the `data` part).
* `i` and `j` denote integer counters. The variables here store neither integers nor counters. Renamed them to — respectively — `key` and `original_value`
* Merged the two `if`s in a single expression: `if i in data.keys() and datas[i] != datas[i]`
* `i in data.keys()` is redundant: dict membership tests on keys already and does so in O(1) whereas list membership test is O(n) and so is generating the keys list probably. So by writing `i in data.keys()` you're doing a membership test in O(2n) and consuming `len(data)` in extra memory, where `i in data` works in constant time and requires little additional memory.
I commend you for using `iteritems()` on the main iteration though, that's nice.
side-note: I'm not sure the `field in data` test is needed though: above, you're reading on `data.keys()` so all the fields in `datas` should already be in `data`, making this test redundant, no?
--
https://code.launchpad.net/~openerp-dev/openobject-client-web/6.0-opw-4834-msh/+merge/61347
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-client-web/6.0-opw-4834-msh.
References