Re: [Tutor] high score lists

2005-04-14 Thread Chris Smith
On Thursday, Apr 14, 2005, D. Hartley wrote: and a question about sorting (either way): I am trying it out with a list of tuples right now. The first problem I ran into is that when i sort it (scorelist.sort(reverse=True)), it sorts by the person's name (the first entry), and not by the score.

Re: [Tutor] high score lists

2005-04-14 Thread Chris Smith
On Thursday, Apr 14, 2005, I wrote: which gives 200 Nina 20 Ben 2 Raj oops, copy and paste error...should be: 200 Nina 20 Ben 2 Raj ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] high score lists

2005-04-15 Thread Chris Smith
On Friday, Apr 15, 2005, at 14:31 America/Chicago, [EMAIL PROTECTED] wrote: So I'm sure that's probably way too much information for most of you!! But my remaining questions are these: 1. what is/where can i get the "pickle" module for storing/saving changes to the high score list? 2. tabs/aligni

Re: [Tutor] high score lists

2005-04-15 Thread Chris Smith
On Friday, Apr 15, 2005, at 20:40 America/Chicago, Jacob S. - [EMAIL PROTECTED] wrote: Great. len is a function though. Why use a second layer of function when len is a function in itself? l = ['d','sea','bee'] l.sort(key=len) l ['d', 'bee', 'sea'] LOL :-) Oooh, that's nice! OK, instead of w

Re: [Tutor] high score lists

2005-04-15 Thread Chris Smith
On Friday, Apr 15, 2005, at 18:46 America/Chicago, [EMAIL PROTECTED] wrote: I did look at your example about using the longest number, but I couldnt really understand all of the code, and ended up deciding to arrange it so that the two columns were left-aligned: it looked like it would align them

[Tutor] snippets helps

2005-04-18 Thread Chris Smith
In a recent post, I believe it was D Hawksworth that noted, So I imported it, asked the shell window for 'help' (egad, technical jargon!) and did a search on python, same result. None of my beginners' tutorials have anything about pickle, unfortunately (very frustrating!) Does anyone know if there

[Tutor] import problem

2005-04-18 Thread Chris Smith
I sent the following to the mac-sig without reply (except for an autoresponder telling me that a person was out of the office :-)). Is there anyone with a mac that could test this code in the IDE to see if you have the same problems? (I don't have problems running it through the 2.4 version of

[Tutor] Weird import problem with PythonIDE on Mac (was 'import problem')

2005-04-20 Thread Chris Smith
On Tuesday, Apr 19, 2005, Lee Cullens wrote: I assume you mean PythonIDE for Python 2.3 (I usually use 2.4 and WingIDE). Here it is (indents screwed up with var font): HTH, Lee C import timeit def y1(): print ’y1 executed’ def y2(): print ’y2 executed’ for f in [y1,y2]: n

[Tutor] Re: Weird import problem with PythonIDE on Mac (was 'import problem')

2005-04-21 Thread Chris Smith
### def y1(): pass def foo(): from __main__ import y1 pass foo() ### Here is a version of the code, stripped of the timeit code. The above segment exhibits the same symptoms as the previously submitted one. Even though I am running this as "__main__" it behaves as though it is not _

Re: [Tutor] Weird import problem with PythonIDE on Mac (was 'import problem')

2005-04-21 Thread Chris Smith
From: Kent Johnson Is it possible that the script is not running as __main__? Add print __name__ to the script and see what it says... It says '__main__'. Here is the end of the output after printing vars() if that helps: '__file__': '/Users/csmith/Desktop/misc python/timeit eg.py', 't': , 'y1'

[Tutor] Re: [Pythonmac-SIG] Weird import problem with PythonIDE on Mac (was 'import problem')

2005-04-22 Thread Chris Smith
On Friday, Apr 22, 2005, at 03:52 America/Chicago, Just van Rossum - [EMAIL PROTECTED] wrote: Importing __main__ is a very silly thing to do anyway, if you ask me. All comments from you, Bob, and Jack have been *very* helpful. I think I understand better what is going on. What's got me scratch

Re: [Tutor] CLS?

2005-04-25 Thread Chris Smith
I have this in my misc library. It was my last attempt at unifying the cls function snippets that I got when I asked about this question some time ago (check the ASPN tutor archives for 'cls'). After adding "darwin" to the test for the system (instead of just 'mac') I got it to work from a sc

[Tutor] Re: Weird import problem with PythonIDE on Mac (was 'import problem')

2005-04-25 Thread Chris Smith
On Friday, Apr 22, 2005, at 10:00 America/Chicago, Max Noel wrote: Do you have a suggestion as to what can I give a module so it has enough information to execute a function that resides in __main__? Here is a visual of what is going on: --__main__ def y1(): pass import foo foo.run(string

[Tutor] Re: input()

2005-04-29 Thread Chris Smith
On Friday, Apr 29, 2005, at 09:48 America/Chicago, [EMAIL PROTECTED] wrote: Hello and thanks in advance. I am trying to prompt the user for some input. I need three values from the user so,I used input() like so; Matrix = input("Matrix=") error=input("error=") alpha= input("alpha=") us

[Tutor] tokenize row numbering

2005-04-29 Thread Chris Smith
I got over my intimidation with tokenize and learned to use it to strip comments from code files. In the process, I learned that the tuples that it returns for the position in the code of various tokens is 1-based in the row rather than 0-based, so the tuple pair (3,1),(3,2) would be the start

[Tutor] enumerate offset?

2005-04-29 Thread Chris Smith
Does anybody else ever run into the case of using enumerate on a slice but then wish that the original list indices were being returned instead of the ones starting at zero? I would like to see an offset argument that could be used with enumerate: ### l=range(5) for i,li in enumerate(l[3:]):

[Tutor] Re: input() : part two

2005-04-30 Thread Chris Smith
I found a work around for the terminal it appears that the message in the input("message") was being assigned to the next variable making Matrix=error=alpha It's good to see that you got this working. Just a couple notes: 1) Regarding your comment above, it just *looks* like it was doing an ass

Re: [Tutor] tokenize row numbering

2005-05-03 Thread Chris Smith
> From: Andrei >> ### >> # line 1 according to tokenize tuple >> # line 2 >> a=b #line 3 >> ### >> >> Does anyone have an idea of *why* the rows/physical lines of code >> beginning their count at 1 instead of 0? In order to process the code >> I > > The snippet above shows that numbering begins

Re: [Tutor] No Need to press Enter

2005-05-04 Thread Chris Smith
> From: Joseph Quigley > What is the secret to have the user press the "Q" key, and the program > exits without pressing the "Enter" key? > Or the "Control" and "Q" keys to exit? > For the Macintosh, would the same command/s for "Control Q" keys be the > same as the "Apple Q" key? > I see that Di

Re: [Tutor] Python challenges

2005-05-06 Thread Chris Smith
On Thursday, May 5, 2005, at 19:33 America/Chicago, [EMAIL PROTECTED] wrote: > Anyone have a gentle hint, or pointer to another 'beginner' tutorial > to regular expressions? > > Thanks! I dont want to get stuck here in the riddles! > How about counting how many times each character is used and

Re: [Tutor] Python challenges

2005-05-06 Thread Chris Smith
> >> Anyone have a gentle hint, or pointer to another 'beginner' tutorial >> to regular expressions? >> >> Thanks! I dont want to get stuck here in the riddles! >> > > How about counting how many times each character is used and look for > the ones that are used infrequently (like only once). Dict

Re: [Tutor] elegant way to turn list into string

2005-05-07 Thread Chris Smith
> while x < 26: > new_alph = alph[1:] + alph[:1] > print new_alph > print "\n" > x += 1 > > But this has the drawback of not progressing with my > newly create alphabet, it just returns: > abcdefghijklmnopqrstuvwxyz The reason that new_alph never changes is that you are calculating

Re: [Tutor] Tutor Digest, Vol 15, Issue 21 (python.org: trusted sender for your account)

2005-05-09 Thread Chris Smith
On Monday, May 9, 2005, at 15:45 America/Chicago, [EMAIL PROTECTED] wrote: > Actually, perhaps this is something you guys would know about! In your > own learning python (or as you watched others learn, if you're one of > the resident experts), have you come across some good challenges for > pyt

Re: [Tutor] Python Challenge - Riddle 2

2005-05-09 Thread Chris Smith
> Am I looking for something like this - > > XXXjXXX? or something like XjXX or XXjX? The former: 3 on each side. Exactly 3. BTW , you can check your understanding by saving the image you get from riddle 6, compressing it with zlib, filtering out all but string.letters and looking for the same

Re: [Tutor] help

2005-05-11 Thread Chris Smith
On Wednesday, May 11, 2005, at 08:09 America/Chicago, [EMAIL PROTECTED] wrote: > hi > i'm trying to extend a list program by adding a test, problem is after > getting the menu of taking the test i can't seem to get the test > running > i.e viewing of questions and answers. here's what i tried t

Re: [Tutor] character format

2005-05-11 Thread Chris Smith
On Wednesday, May 11, 2005, at 20:43 America/Chicago, [EMAIL PROTECTED] wrote: > I believe Max's guess was that the file is compressed with bzip (the > first > two characters will be BZ, as you found). Try doing: > import bz2 print bz2.decompress(data) > > Where data is a string co

Re: [Tutor] Removing lines in string-table

2005-05-17 Thread Chris Smith
On Tuesday, May 17, 2005, at 08:35 America/Chicago, [EMAIL PROTECTED] wrote: > I have a string table (don't recall the right word used in Python > right now) and would like to remove every 'cell' that contains a > string '_thumb.jpg'. There are 1-> digits before the string if that > matters. I m

[Tutor] Running program from Python

2007-07-20 Thread Chris Smith
Howdy, I am working on some research. I'm trying to optimize the performance of an antenna. For the simulation of the antenna it would be easiest to use an antenna software package that I have in my lab. I know that Matlab can call the antenna software through a command called system. Matlab a

[Tutor] Running another program from Python

2007-07-20 Thread Chris Smith
Howdy, I am working on some research. I'm trying to optimize the performance of an antenna. For the simulation of the antenna it would be easiest to use an antenna software package that I have in my lab. I know that Matlab can call the antenna software through a command called system. Matlab a

[Tutor] error help

2006-10-07 Thread Chris Smith
ne tell me why I'm having these error or what I can do to get around them? Chris Smith #Functions for Numerical Program #-- ### The sine and cosine integrals are taken from Abramowitz and Stegun. ### Only use the first 6 terms of the summatio

Re: [Tutor] error help

2006-10-07 Thread Chris Smith
Thanks for the help. That was the problem. I guess I'd been looking at it so long I missed that. The error message wasn't helping me either. Chris Smith Geoframer wrote: > The main problem from what i can tell is that the number of '(' and ')' > you

[Tutor] numpy help

2006-11-03 Thread Chris Smith
Howdy, I'm a college student and for one of we are writing programs to numerically compute the parameters of antenna arrays. I decided to use Python to code up my programs. Up to now I haven't had a problem, however we have a problem set where we are creating a large matrix and finding it's i

[Tutor] Pmw BLT help

2007-03-24 Thread Chris Smith
I'm trying to learn how to use Pmw.BLT to have plotting in some GUIs I would like to create. I have a book with some examples but when I run the code I get this error message which seems to be related to the packages I installed and not my code: Traceback (most recent call last): File "C:\Do

Re: [Tutor] Pmw BLT help

2007-03-25 Thread Chris Smith
Alan Gauld wrote: > "Chris Smith" <[EMAIL PROTECTED]> wrote > > >>I'm trying to learn how to use Pmw.BLT > > >>line 16, in __init__ >>self.vector_x = Pmw.Blt.Vector() >> File "C:\Python24\lib\site-packages\Pmw\Pmw

[Tutor] lazily decorated sort

2012-09-28 Thread Chris Smith
Hi all, I'm wondering if anyone has seen or knows of a good way to do a lazily decorated sort. I was reading about how good the DSU (decorate, sort, undecorate) approach is but the problem that we are running into in SymPy is that we want to get by with a fast hash sort if possible, and only decor