[Zope] question about copyng btree elements

2009-12-16 Thread Yuri
Hi!

I've a Zope BTree called answers. It contains PersistentMapping objects:

self.answers[userid] = PersistentMapping(value=value,
 comments=comments)

value can be a string, a list or a dictionary

what happen exactly if I do: question.answers[a_userdid] = 
question.answers[another_user_id] ?

 From my (poor) tests they seems not to share anything, I mean I can 
modify question.answers[a_userdid] and question.answers[another_user_id] 
is untouched.

Is this true? Should I beware of something?
___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] question about copyng btree elements

2009-12-16 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Yuri wrote:
 Hi!
 
 I've a Zope BTree called answers. It contains PersistentMapping objects:
 
 self.answers[userid] = PersistentMapping(value=value,
  comments=comments)
 
 value can be a string, a list or a dictionary
 
 what happen exactly if I do: question.answers[a_userdid] = 
 question.answers[another_user_id] ?
 
  From my (poor) tests they seems not to share anything, I mean I can 
 modify question.answers[a_userdid] and question.answers[another_user_id] 
 is untouched.
 
 Is this true? Should I beware of something?

I can't reproduce your reported behavior::

- - $ --
$ bin/virtualenv-2.6 --no-site-packages /tmp/yuri
...
$ cd /tmp/yuri/
$ bin/easy_install ZODB3
...
$ bin/python
...
 from BTrees.OOBTree import OOBTree
 from persistent.mapping import PersistentMapping
 answers = OOBTree()
 john = PersistentMapping(value=John's value,
... comment=John's comment)
 answers['john'] = john
 answers['fred'] = answers['john']
 answers['fred'] is john
True
 print john
{'comment': John's comment, 'value': John's value}
 answers['fred']['value'] = Fred's value
 print john
{'comment': John's comment, 'value': Fred's value}
- - $ --


Tres.
- --
===
Tres Seaver  +1 540-429-0999  tsea...@palladion.com
Palladion Software   Excellence by Designhttp://palladion.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkspT6MACgkQ+gerLs4ltQ78PgCfRQMXXXDUOSSuViYtBW18muM7
oVYAoK5iL9klE15WBhjvte8KjNNNUUKt
=br64
-END PGP SIGNATURE-

___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )