RE: cannot import name 'PersistentList'

"Boylan, Ross" <[email protected]>
Newsgroups gmane.comp.web.zope.zodb
Message-ID <[email protected]>
I used PersistentList because I wanted to retain ordering and expect relatively small (i.e., < 1,000 items, quite possibly < 100) lists with infrequent transactions.

I thought of using OOTreeSet's, but wasn't clear on how to use zope.keyreference.  I thought it was a mix-in kind of thing that would make it possible to insert my object into the set.  But I notice objects that subclass Persistent are not supposed to be used as keys; maybe the idea is to use an OOBTree with KeyReferenceToPersistent(myObj) as the key and myObj as the value.  But I think the keyreference isn't defined until after the object is committed, and I need the key before the commit, so that route seems off as well.

I guess since concurrency shouldn't be an issue I could use an IBTree where the key is incremented by 1 for each insertion. But that seems an odd way to get list semantics.  (I'm aware of Counter for concurrency challenged situations, but also not sure how to use it).

Ross

P.S. Sorry; my email client basically forces me to top-post.
________________________________________
From: [email protected] [[email protected]] on behalf of Jim Fulton [[email protected]]
Sent: Wednesday, October 12, 2016 5:17 AM
To: Jean Jordaan
Cc: Boylan, Ross; zodb ‎[[email protected]]‎
Subject: Re: [ZODB] cannot import name 'PersistentList'

On Wed, Oct 12, 2016 at 1:34 AM, Jean Jordaan <[email protected]> wrote:
> Try `from persistent.list import PersistentList`.

Yup.

Also note that PersistentList invites abuse and it's use is rarely
(ever?) a good idea.

Jim

--
Jim Fulton
http://jimfulton.info

--
You received this message because you are subscribed to the Google Groups "zodb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups "zodb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.