[Zope3-dev] how may __setitem__ choose name for a new item?

Stephan Richter srichter at cosmos.phy.tufts.edu
Fri Dec 26 16:39:01 EST 2003


On Thursday 25 December 2003 10:48, Marcus J. Ertl wrote:
> Hi everyone!
>
> Which is the right way, to let a container choose, witch name a new item
> should have, witch is added to it?
>
> Use __setitem__ and ignore the name given to it?

Yes, the new philosophy is that if you need a special method for adding 
content, then you have to write it yourself. For example, we used to have 
setObject(id, obj); the reason this method is gone now is that it required 
you to pass an id, even though it was not necessary. The simplest way for you 
would be to create a method called setObject(obj) or so.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training



More information about the Zope3-dev mailing list