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

Gordon McMillan gmcm@hypernet.com
Tue, 1 Aug 2000 12:16:54 -0400


[Mark]
> To try and get more productive:  Bill, Gordon et al appear to
> have the sense to stay out of this debate.  

Wish I had that much sense...

I'm only +0 on the philosophy of a friendly Pythonic wrapper: 
the registry is only rarely the "right" solution. You need it 
when you have small amounts of persistent data that needs to 
be available to multiple apps and / or Windows. I actively 
discourage use of the registry for any other purposes. So 
making it easy to use is of very low priority for me. 

In addition, I doubt that a sane wrapper can be put over it. At 
first blush, it looks like a nested dict. But the keys are 
ordered. And a leaf is more like a list of tuples [(value, data), ]. 
But if you pull up regedit and look at how it's used, the (user-
speak) "value" may be a (MS-speak) "key", "value" or "data". 
Just note the number of entries where a keyname has one 
(value, data) pair that consists of ("(Default)", "(value not 
set)"). Or the number where keyname must be opened, but 
the (value, data) pair is ("(Default)", something). (It doesn't 
help that "key" may mean "keyname" or "keyhandle", and 
"name" may mean "keyname" or "valuename" and "value" 
may mean "valuename" or "datavalue".)

IOW, this isn't like passing lists (instead of FD_SETs) to  
select. No known abstract container matches the registry. My 
suspicion is that any attempt to map it just means the user 
will have to understand both the underlying API and the 
mapping.

As a practical matter, it looks to me like winreg (under any but 
the most well-informed usage) may well leak handles. If so, 
that would be a disaster. But I don't have time to check it out.

In sum:
 - I doubt the registry can be made to look elegant
 - I use it so little I don't really care

- Gordon