Created
December 2, 2015 20:16
-
-
Save brianray/75122e1b9cade047dc9d to your computer and use it in GitHub Desktop.
fun way to prevent printing of passwords (maybe)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class PasswordStr(object): | |
| """by: brianhray@gmail.com""" | |
| scrubbed_msg = u"xxxxxSCRUBEDxxxxx" | |
| def __init__(self, original): | |
| self.original = original | |
| def __str__(self): | |
| return str(self.scrubbed_msg) | |
| def __unicode__(self): | |
| return self.scrubbed_msg | |
| def __repr__(self): | |
| return self.original | |
| def __cmp__(self, other): | |
| return cmp(self.original, self.original) | |
| def __add__(self, other): | |
| return self.original + other | |
| my_pass = PasswordStr("secret") | |
| print my_pass | |
| x = my_pass | |
| x |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment