[Python-ideas] [Python-Dev] Proposal for the getpass module

Tarek Ziadé ziade.tarek at gmail.com
Sun Feb 7 01:42:51 CET 2010

On Sun, Feb 7, 2010 at 1:30 AM, Guido van Rossum <guido at python.org> wrote:
> [redirecting to python-ideas]
> [..]
> Don't you usually have to tell the keyring which password to retrieve?
> The signature for getpass() doesn't have enough info for that.

I've slightly changed the signature to add two new options:

- service : the name of the service the password is associated to
(defaults to 'Python')
- username: the name of the user (defaults to the value returned by
getpass.getuser() )

These options are not used by the existing functions, but make it
possible for a keyring API
to handle the request properly by getting the password stored for

> I'm not sure that not adding a new module to the stdlib is a
> sufficient reason to foist the new semantics on an old function.

I've done it this way so the "Distutils calls getpass" use case would
work transparently, but maybe it's a bad
idea to add a hook like that after all. Maybe a new API for this would
be better, with a dummy implementation
in the stdlib and a way to configure an external tool to be used.

Tarek Ziadé | http://ziade.org

More information about the Python-ideas mailing list