[Tutor] Clunky Password maker

2011-05-25 Thread Wolf Halton
Is there a less clunky way to do this? [code] def new_pass(): series = ['`', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', \ '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', \ 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', '

Re: [Tutor] Clunky Password maker

2011-05-25 Thread Noah Hall
On Wed, May 25, 2011 at 6:25 PM, Wolf Halton wrote: > Is there a less clunky way to do this? > [code] > def new_pass(): >     series = ['`', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', > '=', \ >               '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', > '+', \ >       

Re: [Tutor] Clunky Password maker

2011-05-25 Thread Sander Sweers
On Wed, 25 May 2011, 19:25:59 CEST, Wolf Halton wrote: > [code] > def new_pass(): >        series = ['`', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', > '=', \ >                            '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', >')', '_', > '+', \ >                         

Re: [Tutor] Clunky Password maker

2011-05-25 Thread Martin A. Brown
Hello, : Is there a less clunky way to do this? Yes. There are probably many ways to do this, and this is just something I cooked up at a moment's notice in reply to your question, and probably could be significantly improved upon. : def new_pass(): Your function takes no arguments. Mayb

Re: [Tutor] Clunky Password maker

2011-05-25 Thread Modulok
On 5/25/11, Wolf Halton wrote: > Is there a less clunky way to do this? > [code] > def new_pass(): > series = ['`', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', > '=', \ > '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', > '+', \ > 'q', 'w', 'e'

Re: [Tutor] Clunky Password maker

2011-05-25 Thread Alan Gauld
"Wolf Halton" wrote Is there a less clunky way to do this? def new_pass(): series = ['`', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', \ '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', \ 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i',

Re: [Tutor] Clunky Password maker

2011-05-25 Thread Adam Bark
On 25/05/11 19:54, Modulok wrote: Depending on what your passwords are going to be protecting, be aware that the default generator in the random module is: "...completely unsuitable for cryptographic purposes." If he's just planning on making a few passwords I think the period of 2**19937-1 of

Re: [Tutor] Clunky Password maker

2011-05-25 Thread Wolf Halton
Now I see. I am going to go woodshed this. Thanks y'all for all the cool ideas! Wolf On May 25, 2011 4:05 PM, "Adam Bark" wrote: > On 25/05/11 19:54, Modulok wrote: >> Depending on what your passwords are going to be protecting, be aware that the >> default generator in the random module is: >>

Re: [Tutor] Clunky Password maker

2011-05-25 Thread naheed arafat
On Wed, May 25, 2011 at 11:25 PM, Wolf Halton wrote: > Is there a less clunky way to do this? > [code] > def new_pass(): > series = ['`', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', > '=', \ > '~', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', > '+', \ >

Re: [Tutor] Clunky Password maker

2011-05-26 Thread Wolf Halton
I have a 0.2 version [code] def new_pass(p): valchars = string.ascii_letters + string.digits + string.punctuation series = list(valchars) pp = int(raw_input("Enter the length you want your password to be:[%i] " % (p)) or p) # length of password chosen or default length

Re: [Tutor] Clunky Password maker

2011-05-26 Thread ian douglas
On 05/26/2011 02:45 PM, Wolf Halton wrote: Now I am looking at how to make it have an admin function to set the valid characters, and have a way to output the password into main() Simple, just learn to use the 'return' statement: [code] def new_pass(p): pp = int(raw_input("Enter the len

Re: [Tutor] Clunky Password maker

2011-05-27 Thread Steven D'Aprano
On Thu, 26 May 2011 05:45:30 am Alan Gauld wrote: [...] > using > the choice() function from the whrandom module. > > passwd = [whrandom.choice(series) for n in range(p)] whrandom was deleted in Python 2.5! I'm not sure when it was formally deprecated, but the recommended way of getting random n

Re: [Tutor] Clunky Password maker

2011-05-27 Thread Alan Gauld
"Steven D'Aprano" wrote whrandom was deleted in Python 2.5! Well, I'm using 2.5 but I confess I didn't try it, I looked up my O'Reilly Python standard Library book because I already had it to hand. It obviously predates 2.5! :-) Alan G. ___ T