RE: [Tutor] Sorting more than one list

2005-03-31 Thread Tony Meyer
> What's b.index(x) do? > > I'm guessing the for a list Delta = ["a,"b","c"], you get > > Delta.index("b") > > 1 > > Am I right? Yes. For future use, the easiest way to answer a question like that is to do: >>> help([].index) Help on built-in function index: index(...) L.index(value,

Re: [Tutor] Sorting more than one list

2005-03-31 Thread Liam Clarke
What's b.index(x) do? I'm guessing the for a list Delta = ["a,"b","c"], you get Delta.index("b") 1 Am I right? On Apr 1, 2005 1:16 PM, py <[EMAIL PROTECTED]> wrote: > > > An alternative way of doing this (if you have python 2.4): > > >>> ppl = ['john', 'mary', 'lary', 'jane'] > >>> age

Re: [Tutor] I am puzzled - help needed

2005-03-31 Thread Kent Johnson
John Carmona wrote: It is WORKING NOW!! You can imagine how long I have spent on that, but I have learnt so much. Many thanks to all the people that have helped me, you will probably see me around asking a zillion other (very basics) questions. Congratulations! I have one^H^H^Htwo small notes be

Re: [Tutor] A Newbie Printing Question

2005-03-31 Thread Liam Clarke
First off, print stills works from an XP cmd.exe, but only for LPT printers, not USB. Secondly, Win32's methods are well documented, using them isn't. There are some tutorials included with the download, and you get a chm help file filled with the objects and methods, but as far as tutorials go,

Re: [Tutor] Sorting more than one list

2005-03-31 Thread py
An alternative way of doing this (if you have python 2.4): >>> ppl =   ['john', 'mary', 'lary', 'jane']>>> age =   [15, 30, 23, 25]>>> height= [160, 165, 178, 170]>>> sortby = lambda a, b: [a[b.index(x)] for x in sorted(b)]>>> sortby(ppl, age)['john', 'lary', 'jane', 'mary']>>> sortby(ppl, height)[

Re: [Tutor] Launching a file browser

2005-03-31 Thread Mike Hall
Ah, so it has to do with access to the window manager. That answers a lot, thanks. On Mar 31, 2005, at 4:09 PM, Max Noel wrote: On Apr 1, 2005, at 00:14, Mike Hall wrote: On Mar 31, 2005, at 12:21 AM, Max Noel wrote: It's been too long since I used Python on MacOSX, but IIRC you can't just run a

Re: [Tutor] A Newbie Printing Question

2005-03-31 Thread jfouhy
Quoting "Jacob S." <[EMAIL PROTECTED]>: > Cool! Does anybody know of... I guess a rather *thorough* tutorial of > win32? for the very reason that I don't know that this existed, and there may > be other things I can use that I'm missing... I don't know of anything online ... It seems a very poorl

Re: [Tutor] Float precision untrustworthy~~~

2005-03-31 Thread Jacob S.
An early language translator app was fed 'Out of sight, out of mind' and then the result fed back in for reverse translation. The output was: 'Invisible, lunatic' Cute, Alan. I like it! Jeff - thanks for the insight. I guess I think more in theory than in reality sometimes. Kent - thanks for your

Re: [Tutor] Float precision untrustworthy~~~

2005-03-31 Thread Jacob S.
I understand what you are talking about, but I tend toward just making it one of the things to remember when working with floats. (I've been bitten a lot when I forget to use '==' instead of '=', too!) Yeah, but it threw me for a loop, because I could find *no*e way to compare a float and an int

Re: [Tutor] A Newbie Printing Question

2005-03-31 Thread Jacob S.
Cool! Does anybody know of... I guess a rather *thorough* tutorial of win32? for the very reason that I don't know that this existed, and there may be other things I can use that I'm missing... TIA, Jacob Richard Lyons wrote: I have little experience with programming. I have Python installed on

Re: [Tutor] A Newbie Printing Question

2005-03-31 Thread Jacob S.
1) For plain text use the old DOS trick of sending output direct to the PRN: file/device - I can't remember if this still works in XP but I can't think why not... The only reason I can think of is that Windows XP is not directly based on DOS, wereas the other versions were. In so doing, they h

Re: [Tutor] Launching a file browser

2005-03-31 Thread Max Noel
On Apr 1, 2005, at 00:14, Mike Hall wrote: On Mar 31, 2005, at 12:21 AM, Max Noel wrote: It's been too long since I used Python on MacOSX, but IIRC you can't just run a Python GUI program from the shell. Or something like that...you should ask this one on the python-mac SIG mailing list: http://w

Re: [Tutor] A simple question about creating a program

2005-03-31 Thread Max Noel
On Mar 31, 2005, at 23:07, Alan Gauld wrote: And if Sun ever get round to finishing their JVM on a chip we'll have a chip that is both OO and procedural! At that point it would be a JRM, then, wouldn't it? :D -- Max maxnoel_fr at yahoo dot fr -- ICQ #85274019 "Look at you hacker... A pathetic c

Re: [Tutor] I am puzzled - help needed

2005-03-31 Thread John Carmona
C Smith, Danny and Kent, thanks for the replies. Here is my programme (I have reinstated the "while loop" C Smith I like very much your method to get the last digits of a number. It is WORKING NOW!! You can imagine how long I have spent on that, but I have learnt so much. Many thanks to all the pe

[Tutor] test

2005-03-31 Thread Bernard Lebel
test! ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] I am puzzled - help needed

2005-03-31 Thread C Smith
I need to rewrite the high_low.py program (see below) to use the last two digits of time at that moment to be the "random number". Be sure you understand what format the time number has and that you understand the problem statement. Here are two time values: 1112306463.0 1112306463.01 Do you se

Re: [Tutor] Launching a file browser

2005-03-31 Thread Mike Hall
On Mar 31, 2005, at 12:21 AM, Max Noel wrote: It's been too long since I used Python on MacOSX, but IIRC you can't just run a Python GUI program from the shell. Or something like that...you should ask this one on the python-mac SIG mailing list: http://www.python.org/sigs/pythonmac-sig/ Kent Yo

Re: [Tutor] a FIFO with fixed capacity?

2005-03-31 Thread Marcus Goldfish
> Let me make sure I understand. Let's imagine that we have such a > CircularQueue, with methods: > >push(element) >pop() >isEmpty() > > [example unittest code] Danny, Yes, it looks like that is a valid unittest for a circular buffer. An enhancement is to modify the accessors:

Re: [Tutor] a FIFO with fixed capacity?

2005-03-31 Thread Danny Yoo
> ps -- as for the need for a circular buffer vs. FIFO: I think my dsp > background pushed me toward the CB. My app involves data acquisition > for extended periods of time. I can't grow the FIFO infinitely, but it > is no big deal if a few samples get overwritten. Does this make sense? Hi Mar

Re: [Tutor] A simple question about creating a program

2005-03-31 Thread Alan Gauld
Just to be picky... > code to be executed by the processor. Machine language is not > object-oriented. In some cases it is. The Rekursiv computer by Linn systems had a CPU that had an OO machine language which supported parallelism by exposing 'threads' as active objects at the machine code l

Re: [Tutor] a FIFO with fixed capacity?

2005-03-31 Thread Alan Gauld
> Would limiting the max capacity of the FIFO improve performance by > allowing one to preallocate the FIFO buffer? In a language like C it would help but in Python there's not much likliehood of advantage. BUt if you were writing a C module to integrate with Python then yes it might be an idea

Re: [Tutor] A simple question about creating a program

2005-03-31 Thread Alan Gauld
> I was wondering, can you make a program the uses alot of classes do > the exact same thing with out useing classes? Yes you can always write a program without classes but it may be a lot more work and its likely to be a lot harder to maintain. Especially if its a big program. However if you

Re: [Tutor] I am puzzled - help needed

2005-03-31 Thread Danny Yoo
> My script is still not working properly, I am obviously missing a > statement somewhere, the script return: > > >>> > Enter a number: 25 > You are just a bit too high, try again > The End > >>> > > The script exits and don't give another try, could you enlight me in > this one, thanks Hi John,

Re: [Tutor] I am puzzled - help needed

2005-03-31 Thread John Carmona
Thanks Kent I kind of see what you are trying to explain to me, it makes it easier by trying the different combination. So even is I change the first line to import time My script is still not working properly, I am obviously missing a statement somewhere, the script return: Enter a number: 25

Re: [Tutor] I am puzzled - help needed

2005-03-31 Thread Kent Johnson
You are just a little confused about imports. If I >>> import time then the name 'time' is bound to the time module: >>> time The time() function is an attribute of the time module: >>> time.time >>> time.time() 1112296322.9560001 Alternatively, I can import the time function directly: >>> f

Re: [Tutor] a FIFO with fixed capacity?

2005-03-31 Thread Kent Johnson
Marcus Goldfish wrote: Danny, Thanks for the informative response. After I sent the email I realized that a circular buffer is a FIFO with fixed capacity, and that is what I want to implement. I think I recall seeing a recipe in the Python Cookbook (1st). If you or anyone else know of other recip

Re: [Tutor] I am puzzled - help needed

2005-03-31 Thread John Carmona
Alan and John thanks for the help. I have now this bit of script but it is not running. -- from time import * n = time() s = str(n) numb = s[-2:] # last two characters of the string numb = in

Re: [Tutor] a FIFO with fixed capacity?

2005-03-31 Thread Marcus Goldfish
Danny, Thanks for the informative response. After I sent the email I realized that a circular buffer is a FIFO with fixed capacity, and that is what I want to implement. I think I recall seeing a recipe in the Python Cookbook (1st). If you or anyone else know of other recipes/implementations pl

Re: [Tutor] I am puzzled - help needed

2005-03-31 Thread Alan Gauld
> exercise. I need to rewrite the high_low.py program (see below) to use the > last two digits of time at that moment to be the "random number". This is > using the import time module. > > I just can't work out how to do that, I have been looking at it for the past > 2,5 hours but can't break it. H

Re: [Tutor] Class and methods?

2005-03-31 Thread Alan Gauld
> I am sorta starting to get it. So you could use __init__ to ask for a > file name to see if there is one in a folder or not if there is then > open that file and conitue where that file left off. If its not there > create a new file with that name, then start the program? Or do I have > that all

Re: [Tutor] Float precision untrustworthy~~~

2005-03-31 Thread Alan Gauld
> between binary and decimal representation. Just as a phrase that's > translated from English into Russian and then back to English again > can have its meaning shifted, Urban legend ,maybe but illustrates the point well: An early language translator app was fed 'Out of sight, out of mind'

[Tutor] Number of socketdescriptors > 250 and open() failed with to many open files

2005-03-31 Thread Ewald Ertl
Hi! In a class derived from thread I open a socket-Connection to a remote Server. Here I start about 500 Thread's on a solaris-System. Sofar there is no problem, when the filedescriptorlimit is set high enough with ulimit -n. My Problem is, when a function in the class tries to open a regular

Re: [Tutor] Cryptography Toolkit

2005-03-31 Thread Mark Thomas
On Thu, 31 Mar 2005 09:14:03 -0500, Kent Johnson <[EMAIL PROTECTED]> wrote: > If you post your code and the complete error message including the stack > trace we may be able to help. > > Kent Thanks Ken I'm getting closer to making this work using the XOR cipher. Here's what I'm doing. from

Re: [Tutor] Cryptography Toolkit

2005-03-31 Thread Kent Johnson
Mark Thomas wrote: Does anyone have some examples on the use of A.M. Kuchling's Python Cryptography Toolkit? I've tried his examples but get "AttributeError" and "TypeError". What I'm trying to do is encrypt/decrypt a file. I'm using Python 2.3 on xp pro. If you post your code and the complete erro

[Tutor] Cryptography Toolkit

2005-03-31 Thread Mark Thomas
Does anyone have some examples on the use of A.M. Kuchling's Python Cryptography Toolkit? I've tried his examples but get "AttributeError" and "TypeError". What I'm trying to do is encrypt/decrypt a file. I'm using Python 2.3 on xp pro. Thanks -- _ ( ) Mark Thomas ASCII ribbon campaign X ww

Re: [Tutor] a FIFO with fixed capacity?

2005-03-31 Thread Danny Yoo
On Wed, 30 Mar 2005, Marcus Goldfish wrote: > I need to implement a FIFO with a fixed maximum capacity. Hi Marcus, Out of curiosity, why do you require a first-in-first-out queue with a maximum capacity? > Would limiting the max capacity of the FIFO improve performance by > allowing one to p

Re: [Tutor] Launching a file browser

2005-03-31 Thread Max Noel
On Mar 31, 2005, at 01:56, Kent Johnson wrote: Mike Hall wrote: I looked over the global module index and the closest thing I could find relating to my os (osx) was EasyDialogs, which has a few functions pertaining to this, "AskFileForOpen()" being one. Calling any function within EasyDialogs ho