[Tutor] sorting variables

2007-10-31 Thread ted b
I am using pygame and i have three variables that i want to sort (var1, var2 and var3) and be able to refer to them later in a statement that will use them in sorted order: the statement i am using is: objSprites = pygame.sprite.OrderedUpdates(var1, var2, var3) and i want var1, var2 and var3 t

Re: [Tutor] question re type()

2007-10-31 Thread Aditya Lal
On 10/31/07, Kent Johnson <[EMAIL PROTECTED]> wrote: > > Aditya Lal wrote: > > On 10/29/07, *Kent Johnson* <[EMAIL PROTECTED] > > wrote: > > > - Common Python practice is to prefer the least restrictive type > check > > possible. > > > I completely agree that the c

Re: [Tutor] Build exe on Vista, have it run on XP?

2007-10-31 Thread Michael Langford
That's not really a working solution. My available development platform is a Vista machine. I don't have an available XP platform. XP built exes run fine on Vista, just not vice versa. --Michael On 10/31/07, O.R.Senthil Kumaran <[EMAIL PROTECTED]> wrote: > > * Michael Langford <[EMAI

Re: [Tutor] Getting single values of a tuple & storing them

2007-10-31 Thread Bill Burns
Trey Keown wrote: > Hey all, > I was wondering, how could I get each value inside of a tuple, say it's > (2,4) . > The only value I really need is the second one (the tuple will always have > only two values. > > Thanks for any help. > Try one of these approaches: In [1]: t = (2, 4) In [2]: t[

Re: [Tutor] perplexing error with shelve REVISED

2007-10-31 Thread Orest Kozyar
> It appears you have a cyclic reference in your doc object. > Try adding "doc.unlink()" before you add it to your shelf. Actually, I just realized that doc.unlink() seems to delete the entire XML content, which kind of defeats the purpose of caching it. I'll check on xml-sig and the comp.lang

[Tutor] Getting single values of a tuple & storing them

2007-10-31 Thread Trey Keown
Hey all, I was wondering, how could I get each value inside of a tuple, say it's (2,4) . The only value I really need is the second one (the tuple will always have only two values. Thanks for any help. ___ Tutor maillist - Tutor@python.org http://mail

[Tutor] Regular Expression help - parsing AppleScript Lists as Strings

2007-10-31 Thread Andrew Wu
Hi, I'm writing utilities to handle return values from AppleScript in python and one of the steps is recognizing when a returned value from an AppleScript execution (via popen and osascript) represents a list (in AppleScript) or not. For the most part I think I have the correct matching pattern,

Re: [Tutor] perplexing error with shelve REVISED

2007-10-31 Thread Kent Johnson
Eric Brunson wrote: > Orest Kozyar wrote: >>> Please post the entire traceback (omitting duplicate lines). >>> >> Sorry, I should have included the traceback. I've revised the sample script >> so that it generates the traceback when run. The sample script is at the >> very bottom of this em

Re: [Tutor] perplexing error with shelve REVISED

2007-10-31 Thread Orest Kozyar
> It appears you have a cyclic reference in your doc object. > Try adding "doc.unlink()" before you add it to your shelf. That fixed the problem. I did not realize that XML documents could have cyclic references. Thanks for all your help! Orest ___

[Tutor] Problem with msvcrt

2007-10-31 Thread Ricardo Aráoz
Hi, was just checking msvcrt module, tried a sample script : >>> import time >>> import msvcrt >>> while True : if msvcrt.kbhit() : key = msvcrt.getch() if key == 'h' : print 'Hello' if key == 'b' :

Re: [Tutor] perplexing error with shelve REVISED

2007-10-31 Thread Kent Johnson
Orest Kozyar wrote: >> Please post the entire traceback (omitting duplicate lines). > > Sorry, I should have included the traceback. I've revised the sample script > so that it generates the traceback when run. The sample script is at the > very bottom of this email. I've poked at this a littl

Re: [Tutor] perplexing error with shelve REVISED

2007-10-31 Thread Eric Brunson
Orest Kozyar wrote: >> Please post the entire traceback (omitting duplicate lines). >> > > Sorry, I should have included the traceback. I've revised the sample script > so that it generates the traceback when run. The sample script is at the > very bottom of this email. > It appears you

Re: [Tutor] perplexing error with shelve REVISED

2007-10-31 Thread Eric Brunson
Orest Kozyar wrote: >> Please post the entire traceback (omitting duplicate lines). >> > > Sorry, I should have included the traceback. I've revised the sample script > so that it generates the traceback when run. The sample script is at the > very bottom of this email. > > ### SCRIPT O

Re: [Tutor] perplexing error with shelve REVISED

2007-10-31 Thread Orest Kozyar
I should also add that when I run this script on my laptop (Windows XP, Python 2.5 r25:51908, 32 bit x84), it does not even print a stacktrace. The interpreter just dumps me back out to the command line. When I use the version of python that comes with cygwin (Python 2.5.1 r251:54863), I get th

Re: [Tutor] perplexing error with shelve REVISED

2007-10-31 Thread Orest Kozyar
This is on: Python 2.5 (r25:51908, Oct 19 2007, 09:46:41) [GCC 4.1.2 20070925 (Red Hat 4.1.2-27)] on linux2 Redhat Fedora release 7 (Moonshine) x86 64 bit processor (SMP) > The program worked fine for me (python 2.5.1 - stackless on > Mac OSX). Can you provide details about your platform (pytho

Re: [Tutor] Build exe on Vista, have it run on XP?

2007-10-31 Thread O.R.Senthil Kumaran
* Michael Langford <[EMAIL PROTECTED]> [2007-10-29 10:59:34]: > I'm trying to build a exe on a vista system using py2exe. It will deploy to > vista and XP systems. If it matters, the application uses pyserial, as well. Before you proceed with lot of other experiments, my suggestion would be build

Re: [Tutor] Looking for suggestions for improving chessTimer.py code

2007-10-31 Thread Kent Johnson
Dick Moores wrote: > At 03:49 AM 10/30/2007, Kent Johnson wrote: >> From here to simple classes is not a big step: >> >> class player(object): >> def __init__(self, name, moveCounter, remainingTime): >> self.name = name >> self.moveCounter = moveCounter >> self.remainingTime = remaini

Re: [Tutor] Inverted Index

2007-10-31 Thread Dinesh B Vadhia
A NumPy matrix (because we have to perform a dot matrix multiplication prior to creating an inverted index). Thank-you! - Original Message - From: Kent Johnson To: Dinesh B Vadhia Cc: tutor@python.org Sent: Wednesday, October 31, 2007 8:16 AM Subject: Re: [Tutor] Inverted Index Di

Re: [Tutor] Looking for suggestions for improving chessTimer.py code

2007-10-31 Thread Dick Moores
At 03:49 AM 10/30/2007, Kent Johnson wrote: >Dick Moores wrote: > 2. I've used 1 for White player, -1 for Black player, and (-1)*player to alternate players. Is there a better way? 3. I've used a lot of variables. Too Many? >>> >>>I think it might work well to either put the player vari

Re: [Tutor] Inverted Index

2007-10-31 Thread Kent Johnson
Dinesh B Vadhia wrote: > Sure! To create an inverted index of a very large matrix (M x N with > M<>N and M>10m rows). Most times the matrix will be sparse but > sometimes it won't be. Most times the matrix will consist of 0's and > 1's but sometimes it won't. How is the matrix represented?

Re: [Tutor] Inverted Index

2007-10-31 Thread Dinesh B Vadhia
Sure! To create an inverted index of a very large matrix (M x N with M<>N and M>10m rows). Most times the matrix will be sparse but sometimes it won't be. Most times the matrix will consist of 0's and 1's but sometimes it won't. Hope that helps. Dinesh - Original Message - From:

Re: [Tutor] Inverted Index

2007-10-31 Thread Kent Johnson
Dinesh B Vadhia wrote: > Hello! Anyone know of any example/cookbook code for implementing > inverted indexes? Can you say more about what you are trying to do? Maybe PyLucene is interesting: http://mail.python.org/pipermail/tutor/2006-April/046116.html http://pylucene.osafoundation.org/ Kent _

[Tutor] Inverted Index

2007-10-31 Thread Dinesh B Vadhia
Hello! Anyone know of any example/cookbook code for implementing inverted indexes? Cheers Dinesh ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] question re type()

2007-10-31 Thread Kent Johnson
Aditya Lal wrote: > On 10/29/07, *Kent Johnson* <[EMAIL PROTECTED] > > wrote: > - Common Python practice is to prefer the least restrictive type check > possible. > I completely agree that the check " type(n) == int " is very intuitive > and simple. Its just th