Re: [Tutor] How to run this block of code dozens of times

2012-09-17 Thread Ray Jones
On 09/17/2012 02:46 AM, eryksun wrote: > On Sun, Sep 16, 2012 at 11:17 PM, Steven D'Aprano wrote: >> Other uses are: >> >> * a single leading underscore usually means "private, don't touch" >> >> * double leading and trailing underscore names have special meaning >> to Python, e.g.: > There's al

Re: [Tutor] How to run this block of code dozens of times

2012-09-17 Thread Oscar Benjamin
On 2012-09-17, Emile van Sebille wrote: > > Be sure you don't at some point depend on _ having a specific value > however, as return values of functions are given the _ name in the > absense of a designated label for the returned value: > > ActivePython 2.6.6.15 (ActiveState Software Inc.) based

Re: [Tutor] How to run this block of code dozens of times

2012-09-17 Thread Emile van Sebille
On 9/16/2012 8:17 PM Steven D'Aprano said... On 17/09/12 10:56, Scurvy Scott wrote: Why would you use an underscore rather than a letter or name like I've always seen. I've never seen an underscore used before. An underscore on its own is often used to mean "don't care". Like a scratch variab

Re: [Tutor] How to run this block of code dozens of times

2012-09-17 Thread eryksun
On Sun, Sep 16, 2012 at 11:17 PM, Steven D'Aprano wrote: > > Other uses are: > > * a single leading underscore usually means "private, don't touch" > > * double leading and trailing underscore names have special meaning > to Python, e.g.: There's also the _() function for I18N: http://docs.pyt

Re: [Tutor] How to run this block of code dozens of times

2012-09-16 Thread Peter Otten
Scurvy Scott wrote: > Actually the loop would run 2^80 times Remember the previous thread? This means the loop will not terminate in the next few million years. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: htt

Re: [Tutor] How to run this block of code dozens of times

2012-09-16 Thread Scurvy Scott
Wow, thanks Dave, et al., for explaining things the way they did. I'm not trying to and apologize for top posting, gmail wasn't giving me the option of replying to all. I definitely understand what was going on and why when you all were explaining the code portions to me. _

Re: [Tutor] How to run this block of code dozens of times

2012-09-16 Thread Steven D'Aprano
On 17/09/12 10:56, Scurvy Scott wrote: Why would you use an underscore rather than a letter or name like I've always seen. I've never seen an underscore used before. An underscore on its own is often used to mean "don't care". Like a scratch variable to hold a result when you don't actually ne

Re: [Tutor] How to run this block of code dozens of times

2012-09-16 Thread Dave Angel
On 09/16/2012 08:56 PM, Scurvy Scott wrote: > On Sun, Sep 16, 2012 at 5:23 PM, Dave Angel wrote: > >> On 09/16/2012 07:56 PM, Scurvy Scott wrote: >>> scratch that, new code is below for your perusal: >>> >>> from Crypto.PublicKey import RSA >>> import hashlib >>> >>> def repeat_a_lot(): >>> co

Re: [Tutor] How to run this block of code dozens of times

2012-09-16 Thread Mark Lawrence
On 17/09/2012 01:56, Scurvy Scott wrote: Why would you use an underscore rather than a letter or name like I've always seen. I've never seen an underscore used before. Try reading some of the documentation here http://www.python.org/doc/ It's amazing what you can learn. -- Cheers. Mark La

Re: [Tutor] How to run this block of code dozens of times

2012-09-16 Thread Scurvy Scott
On Sun, Sep 16, 2012 at 5:23 PM, Dave Angel wrote: > On 09/16/2012 07:56 PM, Scurvy Scott wrote: > > scratch that, new code is below for your perusal: > > > > from Crypto.PublicKey import RSA > > import hashlib > > > > def repeat_a_lot(): > > count = 0 > > while count < 20: > > >You're ki

Re: [Tutor] How to run this block of code dozens of times

2012-09-16 Thread Dave Angel
On 09/16/2012 07:56 PM, Scurvy Scott wrote: > scratch that, new code is below for your perusal: > > from Crypto.PublicKey import RSA > import hashlib > > def repeat_a_lot(): > count = 0 > while count < 20: You're kidding, aren't you? while loops are meant for those times when you don't kn

Re: [Tutor] How to run this block of code dozens of times

2012-09-16 Thread Scurvy Scott
scratch that, new code is below for your perusal: from Crypto.PublicKey import RSA import hashlib def repeat_a_lot(): count = 0 while count < 20: m = RSA.generate(1024) b = hashlib.sha1() b.update(str(m)) a = b.hexdigest() print a[:16] + '.onion'

[Tutor] How to run this block of code dozens of times

2012-09-16 Thread Scurvy Scott
Hello all, I'm just wondering how to run this block of code X amount of times (a lot) and then store the ouput to a .txt file. The code I've written is below. from Crypto.PublicKey import RSA import hashlib m = RSA.generate(1024) b = hashlib.sha1() b.update(str(m)) a = b.hexdigest() print a[:16]