[Tutor] Way to search this mailing list?

2006-10-10 Thread Chris Hengge
Just a simple question... Am I missing some great feature? or is there no way to search rather then going through the archives by hand? Thanks. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] What are these things urandom() returns?

2006-10-10 Thread Tim Peters
[Dick Moores] >>> Would this be a better random source than choice([0,1]), which uses >>> random()? [Tim Peters] >> "Better" as measured against what criteria? [Dick] > I meant would it be closer to true randomness than random(), even if > much slower? Define "closer to true randomness" ;-) I d

Re: [Tutor] Help me with this Tkinter code

2006-10-10 Thread Alan Gauld
> yeh, I am using IDLE. > why, is it a problem?? IDLE is a Tkinter program. So you are trying to run a Tkinter program inside a Tkinter program which can confuse things. The latest versions of IDLE are a lot better but I stilll strongly recommend running any Tkinter , indeed any GUI) programme, fr

[Tutor] Tip: Firefox quicksearch for module docs

2006-10-10 Thread John Fouhy
For all you firefox users out there, create a bookmark in your "Quick searches" bookmark folder with the keyword 'python' and the location 'http://www.python.org/doc/current/lib/module-%s.html'. Then, you can just type (for example): "python random" into the search bar, and go straight to http://w

Re: [Tutor] Help me with this Tkinter code

2006-10-10 Thread Asrarahmed Kadri
The error message is as under:   Microsoft Visual C++ Runtime Library  Runtime Error! Program: C:\python\Lib\site-packages\pythonwin\Pythonwin.exe  This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more inforamtion.Any i

Re: [Tutor] Help me with this Tkinter code

2006-10-10 Thread John Fouhy
On 11/10/06, Luke Paireepinart <[EMAIL PROTECTED]> wrote: > shouldn't you mainloop your root? By convention, you should, but you don't have to. mainloop is mainloop; calling it on root just makes it easy to find. -- John. ___ Tutor maillist - Tutor@

Re: [Tutor] What are these things urandom() returns?

2006-10-10 Thread Alan Gauld
> I'm thinking that just for the hell of it I could use urandom() as a > source of random decimal digits. Or in a coin tossing program. > Here's > a list of 7817 '1's and 0's generated by urandom(): > > >>> from os import urandom > >>> lst = list(urandom(100)) > >>> tosses = [y for y in lst if

Re: [Tutor] Help me with this Tkinter code

2006-10-10 Thread Asrarahmed Kadri
yeh, I am using IDLE. why, is it a problem??  On 10/10/06, Luke Paireepinart <[EMAIL PROTECTED]> wrote: Asrarahmed Kadri wrote:>>> Folks,>> Just started to get my feet wet with basics of Tkinter Programming. > Here is a code which is giving me some problem; when I run it, it> displays me the button

Re: [Tutor] Help me with this Tkinter code

2006-10-10 Thread Asrarahmed Kadri
i changed the code from widget.mainloop() to root.mainloop(); but still its not working     On 10/10/06, Asrarahmed Kadri <[EMAIL PROTECTED]> wrote: yeh, I am using IDLE. why, is it a problem??  On 10/10/06, Luke Paireepinart <[EMAIL PROTECTED] > wrote: Asrarahmed Kadri wrote:>>> Folks,>> Just s

Re: [Tutor] Help me with this Tkinter code

2006-10-10 Thread Luke Paireepinart
Asrarahmed Kadri wrote: > > > Folks, > > Just started to get my feet wet with basics of Tkinter Programming. > Here is a code which is giving me some problem; when I run it, it > displays me the button widget, but when I click it, the window doesn't > goes away. the program gets stuck up.

[Tutor] Help me with this Tkinter code

2006-10-10 Thread Asrarahmed Kadri
    Folks,   Just started to get my feet wet with basics of Tkinter Programming. Here is a code which is giving me some problem; when I run it, it displays me the button widget, but when I click it, the window doesn't goes away. the program gets stuck up. Can anyone help me to resolve this issue??

Re: [Tutor] How to read content in a tar file with tarfile module

2006-10-10 Thread Dave Kuhlman
On Tue, Oct 10, 2006 at 01:19:20PM -0600, Hugo Gonz?lez Monteverde wrote: > Magnus Wirstr?m wrote: > > I have written a app that makes a tar file and all works well... Now i > > want to expand that app so it can read read the tar and give me the > > contents of the tar file. How is the best way t

Re: [Tutor] multithreading random()

2006-10-10 Thread John Fouhy
On 10/10/06, Dick Moores <[EMAIL PROTECTED]> wrote: > I can get what appears to be a random number precise(?) to 17 digits. > How many base-10 digits would a "53-bit > precision float" have, if converted to base 10? > > >>> 2 ** 52 > 4503599627370496L > >>> 2**53 > 9007199254740992L > >>> > > >

Re: [Tutor] Workaround for limitation in xrange()?

2006-10-10 Thread Alan Gauld
"Dick Moores" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Encapsulate the while loop in a generator: > def count(limit): > n=0 > while n yield n > n += 1 > > All 3 are essentially the same, aren't they. Which makes me feel > even > dumber, because I don't understand

Re: [Tutor] multithreading random()

2006-10-10 Thread John Fouhy
On 10/10/06, Dick Moores <[EMAIL PROTECTED]> wrote: > Didn't know about Google's code search, > . What was your search string? Search string was just "jumpahead lang:python". Had to scroll past a bunch of results for python/random.py before I found those, though.

Re: [Tutor] Workaround for limitation in xrange()?

2006-10-10 Thread Dick Moores
At 12:31 PM 10/10/2006, Marc Poulin wrote: >--- Dick Moores <[EMAIL PROTECTED]> wrote: > > > > Andrei's > > Write your own iterator: > > >>> def hugerange(minval, maxval): > > ... val = minval > > ... while val < maxval: > > ... yield val > > ... val += 1 > > > > All 3 are

Re: [Tutor] Workaround for limitation in xrange()?

2006-10-10 Thread Kent Johnson
Dick Moores wrote: > At 11:34 AM 10/10/2006, Kent Johnson wrote: >> Dick Moores wrote: >>> Here are the suggestions I've received: >> >> >>> All 3 are essentially the same, aren't they. >>> Which makes me feel even dumber, because I >>> don't understand any of them. I've consulted 3 >>> books,

Re: [Tutor] What are these things urandom() returns?

2006-10-10 Thread Dick Moores
At 12:51 PM 10/10/2006, Tim Peters wrote: >[Dick Moores] >... >>I'm thinking that just for the hell of it I could use urandom() as a >>source of random decimal digits. > >You could, yes. > >>Or in a coin tossing program. Here's a list of 7817 '1's and 0's >>generated by urandom(): > >Note that the

Re: [Tutor] Workaround for limitation in xrange()?

2006-10-10 Thread Dick Moores
At 11:34 AM 10/10/2006, Kent Johnson wrote: >Dick Moores wrote: >>Here are the suggestions I've received: > > >>All 3 are essentially the same, aren't they. >>Which makes me feel even dumber, because I >>don't understand any of them. I've consulted 3 >>books, and still don't understand the use o

Re: [Tutor] How to read content in a tar file with tarfile module

2006-10-10 Thread Carlos Hanson
On Tue, October 10, 2006 11:15 am, Magnus Wirström wrote: > Hi everyone > > I have written a app that makes a tar file and all works well... Now > i want to expand that app so it can read read the tar and give me the > contents of the tar file. How is the best way to do this ? I can't > find a "li

Re: [Tutor] What are these things urandom() returns?

2006-10-10 Thread Tim Peters
[Dick Moores] ... > I'm thinking that just for the hell of it I could use urandom() as a > source of random decimal digits. You could, yes. > Or in a coin tossing program. Here's a list of 7817 '1's and 0's > generated by urandom(): Note that the length of the list will vary from run to run. Si

Re: [Tutor] Workaround for limitation in xrange()?

2006-10-10 Thread Marc Poulin
--- Dick Moores <[EMAIL PROTECTED]> wrote: > > Andrei's > Write your own iterator: > >>> def hugerange(minval, maxval): > ... val = minval > ... while val < maxval: > ... yield val > ... val += 1 > > All 3 are essentially the same, aren't they. Which > makes me feel even

Re: [Tutor] What are these things urandom() returns?

2006-10-10 Thread Dick Moores
Thanks very much, Kent and Alan. I'm thinking that just for the hell of it I could use urandom() as a source of random decimal digits. Or in a coin tossing program. Here's a list of 7817 '1's and 0's generated by urandom(): >>> from os import urandom >>> lst = list(urandom(100)) >>> toss

Re: [Tutor] How to read content in a tar file with tarfile module

2006-10-10 Thread Hugo González Monteverde
Magnus Wirström wrote: > I have written a app that makes a tar file and all works well... Now i > want to expand that app so it can read read the tar and give me the > contents of the tar file. How is the best way to do this ? I can't find > a "listdir" like function in tarfile. Can anyone point

Re: [Tutor] Workaround for limitation in xrange()?

2006-10-10 Thread Kent Johnson
Dick Moores wrote: > Here are the suggestions I've received: > > All 3 are essentially the same, aren't they. Which makes me feel even > dumber, because I don't understand any of them. I've consulted 3 > books, and still don't understand the use of yield. Yes, they are pretty much the same. M

[Tutor] How to read content in a tar file with tarfile module

2006-10-10 Thread Magnus Wirström
Hi everyone I have written a app that makes a tar file and all works well... Now i want to expand that app so it can read read the tar and give me the contents of the tar file. How is the best way to do this ? I can't find a "listdir" like function in tarfile. Can anyone point me in the right

Re: [Tutor] Workaround for limitation in xrange()?

2006-10-10 Thread Dick Moores
> >> >>> for x in xrange(2**31): >> pass >> >>Traceback (most recent call last): >> File "", line 1, in >> for x in xrange(2**31): >>OverflowError: long int too large to convert to int > Here are the suggestions I've received: Danny's ># >def myxrange(m, n=None, skip=1

Re: [Tutor] Workaround for limitation in xrange()?

2006-10-10 Thread Danny Yoo
> >>> for x in xrange(2**31): > pass > > Traceback (most recent call last): > File "", line 1, in > for x in xrange(2**31): > OverflowError: long int too large to convert to int Hi Dick, Hmmm... I'd consider this a misfeature in the implementation. Apparently xrange (and range) mus

Re: [Tutor] Workaround for limitation in xrange()?

2006-10-10 Thread Andrei
Dick Moores rcblue.com> writes: > I can think of 2 workarounds for this 2**31 limitation in xrange(). > Use a while loop instead. Or use 2 or more for loops, keeping the > number of cycles in each under 2**31. > > Are there others? Write your own iterator: >>> def hugerange(minval, maxval)

Re: [Tutor] Workaround for limitation in xrange()?

2006-10-10 Thread Kent Johnson
Dick Moores wrote: > >>> for x in xrange(2**31): > pass > > Traceback (most recent call last): >File "", line 1, in > for x in xrange(2**31): > OverflowError: long int too large to convert to int > >>> > > I can think of 2 workarounds for this 2**31 limitation in xrange(). > Use

[Tutor] Workaround for limitation in xrange()?

2006-10-10 Thread Dick Moores
>>> for x in xrange(2**31): pass Traceback (most recent call last): File "", line 1, in for x in xrange(2**31): OverflowError: long int too large to convert to int >>> I can think of 2 workarounds for this 2**31 limitation in xrange(). Use a while loop instead. Or use 2 or more f

Re: [Tutor] Need problems to enhance programming skills

2006-10-10 Thread Geoframer
Hi Asrarahmed,   I recently started learning python. To reinforce the core language concepts I used the following website :   http://www.spoj.pl/   This site features a large number of programming problems which you can solve in any number of programming language (including Python) and you can have

[Tutor] Need problems to enhance programming skills

2006-10-10 Thread Asrarahmed Kadri
    Folks,   Have you got set of programming problems in python to reinforce the core language concepts and also build logic.   thanks.   Regards, Asrar-- To HIM you shall return. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/lis

Re: [Tutor] Seeking good resources for Tkinter

2006-10-10 Thread Asrarahmed Kadri
Thanks for the reply.   The rule is: "when in doubt, always ask".  Sorry if a similar question was answered previously.Regards, Asrar   On 10/10/06, Alan Gauld <[EMAIL PROTECTED]> wrote: > I want to learn the GUI programming in Python. Can you suggest some> nice web> resources as well as books to s

Re: [Tutor] What are these things urandom() returns?

2006-10-10 Thread Alan Gauld
> source. The returned data should be unpredictable enough for > cryptographic applications, though its exact quality depends on the > OS implementation. > >>> from os import urandom > >>> urandom(10) > '[EMAIL PROTECTED]' > >>> > > ??? Its a string of bytes which you can use to encrypt data. The

Re: [Tutor] What are these things urandom() returns?

2006-10-10 Thread Kent Johnson
Dick Moores wrote: > "urandom(n) > > Return a string of n random bytes suitable for cryptographic use. > This function returns random bytes from an OS-specific randomness > source. The returned data should be unpredictable enough for > cryptographic applications, though its exact quality depends

Re: [Tutor] multithreading random()

2006-10-10 Thread Dick Moores
At 09:51 PM 10/9/2006, you wrote: >On 10/10/06, Dick Moores <[EMAIL PROTECTED]> wrote: > > And another question. That page also says, "Almost all module > > functions depend on the basic function random(), which generates a > > random float uniformly in the semi-open range [0.0, 1.0). Python uses >

Re: [Tutor] multithreading random()

2006-10-10 Thread Dick Moores
At 09:57 PM 10/9/2006, you wrote: >On 10/10/06, Dick Moores <[EMAIL PROTECTED]> wrote: > > Please refer to > > , from > which I quote: > > > > "The functions supplied by this module are actually bound methods of > > a hidden instance of the

[Tutor] What are these things urandom() returns?

2006-10-10 Thread Dick Moores
"urandom(n) Return a string of n random bytes suitable for cryptographic use. This function returns random bytes from an OS-specific randomness source. The returned data should be unpredictable enough for cryptographic applications, though its exact quality depends on the OS implementation. On