Discussion:
[Erp5-dev] showDict - why reference, if name _might_ suggest copy?
Łukasz Nowak
2007-06-27 10:15:28 UTC
Permalink
Hello,

I've spotted little error why playing on developer site. Reading
function name 'showDict' I assume that it will return copy of object
dict, and modified it - well, it was little disaster, but it is normal
on developer site ;)

I'm only asking about naming convention - shall be showDict[1] renamed
to getDict for returning reference, or shall it return copy of dict when
named showDict?

Luke

[1]http://svn.erp5.org/erp5/trunk/products/ERP5Type/Base.py?revision=14978&view=markup#showDict
--
?ukasz Nowak R&D Ventis http://www.ventis.com.pl/
tel: +48 32 768 16 85 fax: +48 32 392 10 61
``Use the Source, Luke...''
Jérôme Perrin
2007-06-27 17:46:23 UTC
Permalink
Post by Łukasz Nowak
Hello,
I've spotted little error why playing on developer site. Reading
function name 'showDict' I assume that it will return copy of object
dict, and modified it - well, it was little disaster, but it is normal
on developer site ;)
Hello,

Returning a reference can be a problem, because you can modify the object's
__dict__ from restricted environment (even if the object will not be marked as
modified from ZODB point of view). I changed it to return a copy.
Post by Łukasz Nowak
I'm only asking about naming convention - shall be showDict[1] renamed
to getDict for returning reference, or shall it return copy of dict when
named showDict?
Here, "show" was for "look but don't touch" ;)

J?rome

Loading...