Re: [Tutor] Basic Help Implementing Saved Scripts

2008-07-09 Thread John Fouhy
On 10/07/2008, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi, > Sorry for this, most likely, idiotic question on my part. I'm really > liking Python and it's > ease of use. My only trouble is that I'm not sure how to use a script that > I've saved, during > another script located withi

[Tutor] Basic Help Implementing Saved Scripts

2008-07-09 Thread jar_head
Hi, Sorry for this, most likely, idiotic question on my part. I'm really liking Python and it's ease of use. My only trouble is that I'm not sure how to use a script that I've saved, during another script located within the same folder. The idea is that I want to make a few functions a

[Tutor] python beginner

2008-07-09 Thread Fred @ Mac
I have an external app that writes out a very basic xml files that contains data that needs to be processed. For Example, one type of job would be a simple file copy. So in the XML file there would be (among other bits of information about the job) things like CopyFiles Frank ( for who su

Re: [Tutor] build list of non-empty variables

2008-07-09 Thread John Fouhy
On 10/07/2008, Kent Johnson <[EMAIL PROTECTED]> wrote: > On Wed, Jul 9, 2008 at 9:38 PM, John Fouhy <[EMAIL PROTECTED]> wrote: > > Is the generator expression grammar right? How do I parse, e.g., > > '(x+1 for x in range(10))'? Seems like there's nothing there for > > 'range(10)'. Like it shou

Re: [Tutor] build list of non-empty variables

2008-07-09 Thread Kent Johnson
On Wed, Jul 9, 2008 at 9:38 PM, John Fouhy <[EMAIL PROTECTED]> wrote: > On 10/07/2008, Kent Johnson <[EMAIL PROTECTED]> wrote: >> The actual formal syntax definitions for the two are slightly different: >> http://docs.python.org/ref/lists.html >> http://docs.python.org/ref/genexpr.html > Is the

Re: [Tutor] build list of non-empty variables

2008-07-09 Thread John Fouhy
On 10/07/2008, Kent Johnson <[EMAIL PROTECTED]> wrote: > The actual formal syntax definitions for the two are slightly different: > http://docs.python.org/ref/lists.html > http://docs.python.org/ref/genexpr.html > > Presumably this means there is something that is syntactically allowed > in on

Re: [Tutor] build list of non-empty variables

2008-07-09 Thread Kent Johnson
On Wed, Jul 9, 2008 at 8:17 PM, Alan Gauld <[EMAIL PROTECTED]> wrote: > No I meant in syntactic terms. > We usually define an LC as > > [ expr for vars in sequence if expr ] > > or somesuch imprecise gobbledy gook ;-). > > Now we can define the generator expr (syntax) as > > expr for vars in

Re: [Tutor] build list of non-empty variables

2008-07-09 Thread Alan Gauld
"Tim Golden" <[EMAIL PROTECTED]> wrote In fact I guess you could say that the new definition of a list comprehension is [ generator expression] Well, not if sure if you meant that literally No I meant in syntactic terms. We usually define an LC as [ expr for vars in sequence if expr ] o

Re: [Tutor] line class

2008-07-09 Thread Alan Gauld
"Kent Johnson" <[EMAIL PROTECTED]> wrote Usually based on magnitude alone. That seems a pretty strange definition of equal, that makes (1, 0) == (0, 1). Yes I know! But actually in many engineering situations where phase is not important it's a good first approximation (for example power ca

Re: [Tutor] Problem with creating class instance

2008-07-09 Thread Kent Johnson
On Wed, Jul 9, 2008 at 5:02 PM, Mike Meisner <[EMAIL PROTECTED]> wrote: > In creating a Player instance, that instance can create the Stats class, > but when creating the first instance within the Stats class of a Details > class, it fails with the following traceback: > > Traceback (most recent

Re: [Tutor] Python Characteristics.

2008-07-09 Thread Michael Langford
To add to Alan: On Wed, Jul 9, 2008 at 2:34 PM, Alan Gauld <[EMAIL PROTECTED]> wrote: > > You can interact with the operating system and file system using > modules such as os etc. But you can't do it directly as you can > in bash. But that is because bash has built in capability to execute > exte

[Tutor] Problem with creating class instance

2008-07-09 Thread Mike Meisner
I've just started using classes in Python. The basic goal is to develop a script that tracks individual player stats for poker tournaments. This involves nesting a class within a class within a class. The Player class incorporates a Stats class (three instances for three different game types)

Re: [Tutor] build list of non-empty variables

2008-07-09 Thread Tim Golden
Alan Gauld wrote: In fact I guess you could say that the new definition of a list comprehension is [ generator expression] Well, not if sure if you meant that literally, but it's certainly not: that would be a list whose one item was a generator expression: squares = (x * x for x in range (1

[Tutor] Text Editor With Speech

2008-07-09 Thread FT
Hi! I am coming closer to the talking editor and voice adjustments inside my editor/talking module. When reading the events over and over again I am slowly understanding who wants what. Inside an editor there are key commands that do certain things and I try to give some voice to them.

Re: [Tutor] Python Characteristics.

2008-07-09 Thread Alan Gauld
"Jeremiah Stack" <[EMAIL PROTECTED]> wrote I was pondering something. when you are in the live environment receiving immediate feedback is it basically a compiler (or program), responding to what the user inputs, Yes, technically its an interpreter rather than a compiler, although there i

Re: [Tutor] build list of non-empty variables

2008-07-09 Thread Alan Gauld
"Don Jennings" <[EMAIL PROTECTED]> wrote return ';'.join(x for x in l if x) Ah! A list comprehension. Not at that point in the learning python book, Not quite, I believe its called a generator expression. Its like a list comprehension but without the [] around it. In fact I guess you coul

Re: [Tutor] line class

2008-07-09 Thread Kent Johnson
On Wed, Jul 9, 2008 at 2:17 PM, Alan Gauld <[EMAIL PROTECTED]> wrote: > "Kent Johnson" <[EMAIL PROTECTED]> wrote >> >> That just raises the question of how do complex numbers compare? > > Usually based on magnitude alone. > That's why I said the results would be equivalent to the length of a point

Re: [Tutor] line class

2008-07-09 Thread Alan Gauld
"Kent Johnson" <[EMAIL PROTECTED]> wrote That just raises the question of how do complex numbers compare? Usually based on magnitude alone. That's why I said the results would be equivalent to the length of a point approach. You assume that any point on the same sperical locus is equal. At

Re: [Tutor] Python Characteristics.

2008-07-09 Thread Steve Willoughby
Jeremiah Stack wrote: Hello All, I was pondering something. when you are in the live environment receiving immediate feedback is it basically a compiler (or program), responding to what the user inputs, or is it like the bash shell where I could tell it to search the file system for a certain fi

[Tutor] Python Characteristics.

2008-07-09 Thread Jeremiah Stack
Hello All, I was pondering something. when you are in the live environment receiving immediate feedback is it basically a compiler (or program), responding to what the user inputs, or is it like the bash shell where I could tell it to search the file system for a certain file? Or how does python

Re: [Tutor] How to create array of variants?

2008-07-09 Thread Kelie
Monika Jisswel googlemail.com> writes: > > > Comment : I never did any VB so I am not sure if I understand you.supposing your data comes like this :python code : > > > Data = ( ('A', 1), ('B', 2), ('C', 3), ('D', 4) )#you can create a list of the items like this : List_Letters = [ x[0] for x

Re: [Tutor] line class

2008-07-09 Thread Kent Johnson
On Wed, Jul 9, 2008 at 3:05 AM, Alan Gauld <[EMAIL PROTECTED]> wrote: > > Rather than comparing in that manner I'd take a different approach. > I'd measure the length from the origin thus any point that was inside > the circle upon whose ciorcumference the point sits is less than > the point. Any p

Re: [Tutor] build list of non-empty variables

2008-07-09 Thread Don Jennings
Ah! A list comprehension. Not at that point in the learning python book, yet, but I will be soon. Thanks! Don On Tue, Jul 8, 2008 at 9:34 PM, Kent Johnson <[EMAIL PROTECTED]> wrote: > On Tue, Jul 8, 2008 at 6:35 PM, Don Jennings <[EMAIL PROTECTED]> wrote: > > > def __unicode__(self): > >

Re: [Tutor] line class

2008-07-09 Thread Alan Gauld
"Christopher Spears" <[EMAIL PROTECTED]> wrote def __cmp__(self, other): if self.x == other.x and self.y == other.y: return 0 elif self.x < other.x and self.y < other.y: return -1 elif self.x > other.x and self.y > other.y: return 1 Rather than comparing in that manner I'd