RE: [ZODB-Dev] oids, numbers, hex and 8-byte strings

2005-11-03 Thread Dieter Maurer
Tim Peters wrote at 2005-11-1 15:00 -0500:
 ...
I don't want to see any renaming, or aliasing, until the docs (comments 
docstrings) are clear.

Usually, I am convinced that well chosen names form the largest part
of the required documentation.

That's why I sometimes call things bugs (do not behave as the name suggests)
while you call them accidental artifacts (different behaviour not
promissed by formal documentation).

In this special case, p64 (and its counterpart u64) is not
too badly chosen. When one knows (in addition) that oids are 64 bit
strings, one can deduce for what they are good for.

-- 
Dieter
___
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev


Re: [ZODB-Dev] oids, numbers, hex and 8-byte strings

2005-11-02 Thread Dieter Maurer
Chris Withers wrote at 2005-10-25 13:11 +0100:
 ...
The alias I suggested is purely to mirror that of the oid_repr function, 
and I would include it directly above of below the oid_repr function 
with bigger documentation clues for blind people like me ;-)

Does anyone have any non-pedantic reasons for not including this alias?

The name is far less than optimal.

   How about something more informative such as oid_to_hex
   and oid_from_hex?

-- 
Dieter
___
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev


Re: [ZODB-Dev] oids, numbers, hex and 8-byte strings

2005-10-27 Thread Chris Withers

Tim Peters wrote:

no inverse for oid_repr, and there isn't a need for one.  For any 8-byte
string oid S,

p64(int(oid_repr(S), 0)) == S

so that's how to get an inverse of oid_repr if you really want one
(although I don't know why anyone would).


...'cos oid_repr is what gets used to log those Shouldn't load state 
for errors, so I needed to take something from oid_repr and trun it 
into something I could try and use with app._p_jar[...]



+1 on better documention:  improve docstrings, add comments, add overviews.
If anyone's worried about it, adding comments does not increase Python's
runtime wink.


Thanks, so trunk, and which branches again for this?

cheers,

Chris

--
Simplistix - Content Management, Zope  Python Consulting
   - http://www.simplistix.co.uk
___
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev


RE: [ZODB-Dev] oids, numbers, hex and 8-byte strings

2005-10-27 Thread Tim Peters
[Tim]
 There is no inverse for oid_repr, and there isn't a need for one.
  For any 8-byte string oid S,

 p64(int(oid_repr(S), 0)) == S

 so that's how to get an inverse of oid_repr if you really want one
 (although I don't know why anyone would).

[Chris]
 ...'cos oid_repr is what gets used to log those Shouldn't load state
 for errors, so I needed to take something from oid_repr and trun it into
 something I could try and use with app._p_jar[...]

Confusing integers with strings.  Maybe you do see the 0x01 in

Shouldn't load state for 0x01 when the connection is closed

as a string instead of as an integer, but that can't be common.

 +1 on better documention:  improve docstrings, add comments, add
 overviews. If anyone's worried about it, adding comments does not
 increase Python's runtime wink.

 Thanks, so trunk, and which branches again for this?

3.4 branch and 3.5 branch.  By this time next week, 3.6 branch may also
exist (and the trunk will then be for 3.7 development).  Under CVS,
Zope-2_7-branch (for the ZODB 3.2 line).  Only the ZODB 3.1 and 3.3 lines
are dead.  I don't see much point in bothering to change older lines myself;
e.g., ZODB 3.5 exists solely for the Zope 3.1 line (Zope 2.8 uses 3.4, and
Zopes 2.9 and 3.2 will use ZODB 3.6).

___
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev


Re: [ZODB-Dev] oids, numbers, hex and 8-byte strings

2005-10-25 Thread Jim Fulton

Jeremy Hylton wrote:

On 10/25/05, Chris Withers [EMAIL PROTECTED] wrote:


Dieter Maurer wrote:


  def p64(v):
  Pack an integer or long into a 8-byte string


Yes, but for that to be meaningful, you have to know that:

- 0xSomething is an integer or long (it read hex number in my head

- oids are 8-byte strings

Neither of things that sit in my brain :-(


But, you knew all this. Otherwise, you would not have been
able to implement the oid_[un]repr functions.


I didn't implement oid_repr. I traced the code to find that was
generating the conflict error. I think worked back from that to end up
with oid_unrepr. The first time I became aware of p64 was when you
mentioned it...



http://mail.zope.org/pipermail/zodb-dev/2002-December/004091.html

Perhaps the content of that message just confirms your overall
argument, but you were definitely aware of p64 in the past.  If these
things don't sit in your brain, then it's probably best just to have
reasonable documentation somewhere -- say a Wiki page that explains
the trinity of oid, timestamp, and transaction id and tells you how to
read and write them.


While I like wikis for lots of things, in general, I prefer programmer
documentatoon to be managed with the code.

Jim

--
Jim Fulton   mailto:[EMAIL PROTECTED]   Python Powered!
CTO  (540) 361-1714http://www.python.org
Zope Corporation http://www.zope.com   http://www.zope.org
___
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev