[Python-ideas] Password masking for getpass.getpass

Chris Angelico rosuav at gmail.com
Tue Jan 12 20:50:23 EST 2016


On Wed, Jan 13, 2016 at 12:11 PM, Muhammad Ahmed Khalid
<khali119 at umn.edu> wrote:
> Therefore I have created a solution but I think the feature should come by
> default (and the programmer should have the option to use a blank or any
> other character).
>
> The code lives here: https://goo.gl/OeY3QI
>
> Please let me know about your thoughts on the issue. Also my apologies if
> this is the wrong mailing list. Please guide me in the right direction if
> that is the case.

First off, here's a direct link, bypassing the URL shortener.

https://code.activestate.com/recipes/579148-add-password-masking-ability-to-getpassgetpass/?in=user-4193393

The use of raw_input at the end suggests that you're planning this for
Python 2.7, and not for 3.x. Does your code work (apart from that,
which is insignificant) on Python 3? If not, this would be well worth
considering; this mailing list is all about new features for the new
versions of Python, which means 3.6 at the moment. Cool snippets of
Py2 code might be useful as ActiveState recipes, or as PyPI modules,
but they won't be added to the core language.

You've used the Windows-only msvcrt module. That means your snippet
works only on Windows, which you acknowledge in a comment underneath
it. I'm echoing that here on the list to make sure that's clear.

Have you checked PyPI (pypi.python.org) for similar code that already exists?

ChrisA


More information about the Python-ideas mailing list