[Python-Dev] Proposal: Registry access for Python on Windows

Mark Hammond mhammond@skippinet.com.au
Thu, 3 Feb 2000 10:00:41 +1100


> I propose to include functions to access the windows registry
> into the python 1.6 core.

Agreed!

> I have thrown together some code which I will post hopefully
> tomorrow, but I would like to hear some comments before.
>
> ----------------------------------------------------------------------
> winreg - registry access module

Im not convinced that we need either a) a new implementation, or b) a new
API.

I would propose that we use the existing registry access functions from
win32api - as I didnt code them, Im not suggesting this due to my own ego.
The reasons for my beliefs are:

* The new API does not add any new value.  The only changes I can see are
that OpenKey() has had a reserved value dropped and QueryValue() has an
extra redundant result.  Indeed the new API does not appear a new API at
all, so should be clearly stated if indeed it is (and in which case, exactly
what the changes are) or be documented as a pythonic wrapping of the
existing win32 registry API.  Further, there is some useful functionality
dropped.

* Well tested.  There are some obscure rules and code that experience has
shown we need.  It would be a shame to reinvent those wheels.  It has taken
a few years to get it "just right", and this was an implementation by people
who know their stuff!

Why not take the existing code as it stands (which _does_ include an
auto-closing key) and add a new .py wrapper?  At least Python will have a
"complete, but low-level" registry API, and a higher level "easier to use,
but maybe not complete" layer implemented in Python.

Indeed, Guido has stated that the existing win32api functions would be
suitable for the core.  However, the issue is the "coding style" - and I
admit that if I knew exectly what that meant I would make the change - eg,
if it only means renaming the identifiers it would be trivial - however, it
would also appear to be excessively anal, so Im sure there is more to it
than that :-)

And-I-think-I-will-stay-out-of-the-ternary-debate-ly,

Mark.