[Erp5-dev] showDict - why reference, if name _might_ suggest copy?

Jérôme Perrin jerome at nexedi.com
Wed Jun 27 19:46:23 CEST 2007


Le mercredi 27 juin 2007 12:15, Łukasz Nowak a écrit :
> 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.

> 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



More information about the Erp5-dev mailing list