[Python-Dev] New winreg module really an improvement?

Paul Prescod paul@prescod.net
Wed, 02 Aug 2000 03:30:30 -0400


Guido van Rossum wrote:
> 
> ...
> 
> I believe this is the crux of the problem.  Your only mistake was that
> you criticized and then tried to redesign a (poorly designed) API that
> you weren't intimately familiar with.

I don't think that this has been demonstrated. We have one complaint
about one method from Mark and silence from everyone else (and about
everything else). The Windows registry is weird in its terminology, but
it isn't brain surgery.

Yes, I had to do some research on what various things do but I expect
that almost anyone would have had to do that. Some of the constants in
the module are meant to be used with functions that are not even exposed
in the module. This indicates to me that nobody has clearly thought out
all of the details (and also that _winreg is not a complete binding to
the API). I probably understand the original API as well as anyone and
more than most, by now.

Anyhow, the list at the bottom should demonstrate that I understand the
API at least as well as the Microsoftie that invented the .NET API for
Java, VB and everything else.

> Hopefully someday someone will eventually create a set of higher level
> bindings modeled after the Java, VB or C# version of the API.

Mark sent me those specs and I believe that the module I sent out *is*
very similar to that higher level API.

Specifically (>>> is Python version)

Equals (inherited from Object) 
>>> __cmp__

key.Name
>>> key.name

key.SubKeyCount
>>> len( key.getSubkeys() )

key.ValueCount
>>> len( key.getValues() )

Close
>>> key.close()

CreateSubKey
>>> key.createSubkey()

DeleteSubKey
>>> key.deleteSubkey()

DeleteSubKeyTree
>>> (didn't get around to implementing/testing something like this)

DeleteValue
>>> key.deleteValue()

GetSubKeyNames
>>> key.getSubkeyNames()

GetValue
>>> key.getValueData()

GetValueNames
>>> key.getValueNames()

OpenRemoteBaseKey
>>> key=RemoteKey( ... )

OpenSubKey
>>> key.openSubkey

SetValue
>>> key.setValue()

 ToString
>>> str( key )

My API also has some features for enumerating that this does not have.
Mark has a problem with one of those. I don't see how that makes the
entire API "unintuitive", considering it is more or less a renaming of
the .NET API.

-- 
 Paul Prescod - Not encumbered by corporate consensus
"I don't want you to describe to me -- not ever -- what you were doing
to that poor boy to make him sound like that; but if you ever do it
again, please cover his mouth with your hand," Grandmother said.
	-- John Irving, "A Prayer for Owen Meany"