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

Paul Prescod paul@prescod.net
Tue, 01 Aug 2000 12:53:31 -0400


Guido van Rossum wrote:
> 
> I vaguely remember that I wasn't happy with the way this was handled
> either, but was too busy at the time to look into it.  (I can't say
> whether I'm happy with the module or not, since I've never tried to
> use it.  But I do feel unhappy about the process.)

I was also unhappy with the process but from a differEnt perspective.

A new module appeared in the Python library: _winreg It was based on
tried and true code: _winreg, but it's API had many placeholder
arguments (where Microsoft had placeholder arguments) used function call
syntax for things that were clearly methods (as Microsoft did for C),
had an enumeration mechanism that seems, to me, be very unPythonic, 
had many undocumented features and constants, and the documented 
methods and properties often have weird Microsoft conventions 
(e.g. SetValueEx).

The LaTeX documentation for the old winreg says of one method: "This is
Lame Lame Lame, DO NOT USE THIS!!!"

Now I am still working on new winreg. I got involved in a recursive 
project to avoid writing the docs twice in two different formats. We 
are still in the beta period so there is no need to panic about 
documentation yet.

I would love nothing more than to hear that Windows registry handling is
hereby delayed until Python 7 or until someone more interested wants to
work on it for the love of programming. But if that is not going to
happen then I will strongly advise against falling back to _winreg which
is severely non-Pythonic.

> I vaguely remember that Paul Prescod's main gripe with the _winreg API
> was that it's not object-oriented enough -- but that seems his main
> gripe about most code these days. :-)

In this case it wasn't a mild preference, it was a strong allergic
reaction!

> Paul, how much experience with using the Windows registry did you have
> when you designed the new API?

I use it off and on. There are still corners of _winreg that I don't
understand. That's part of why I thought it needed to be covered up with
something that could be fully documented. To get even the level of
understanding I have, of the *original* _winreg, I had to scour the Web.
The perl docs were the most helpful. :)

Anyhow, Mark isn't complaining about me misunderstanding it, he's
complaining about my mapping into the Python object model. That's fair.
That's what we python-dev is for.

As far as Greg using _winreg, my impression was that that code predates
new winreg. I think that anyone who reads even just the docstrings for
the new one and the documentation for the other is going to feel that 
the new one is at the very least more organized and thought out. Whether
it is properly designed is up to users to decide.

-- 
 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"