Re: [Tutor] Ooer, OT Lisp

2005-01-21 Thread Danny Yoo
On Thu, 20 Jan 2005, Bill Mill wrote: > There is no "standard" implementation of lisp, so sockets and os access > all vary by implementation. Furthermore, the docs are sketchy and hard > to read with all of the lisps I've tried. Hi Liam, Scheme is a recent dialect of Lisp that seems to be well

[Tutor] Combination

2005-01-21 Thread Guillermo Fernandez Castellanos
Hi, I'm trying to take a list and find all the unique combinations of that list. I mean: if I enter (1,2,3,4,5) and I watn combinations of 3, I want to find: (1,2,3) but then not (2,1,3), (3,1,2),... (1,2,4) (1,2,5) (2,3,5) (3,4,5) The thing is, I want to do it as a generic function, where I pas

Re: [Tutor] Combination

2005-01-21 Thread Kent Johnson
This question comes up regularly on comp.lang.python. Search the archives for 'combinations' to find *many* discussions of how to do it. Also there are several recipes in the cookbook. http://groups-beta.google.com/group/comp.lang.python?hl=en&lr=&ie=UTF-8&c2coff=1 http://aspn.activestate.com/ASPN

Re: [Tutor] Ooer, OT Lisp

2005-01-21 Thread Kent Johnson
Liam Clarke wrote: Oops, and OT ~ Has anyone used Lisp? I've been reading Paul Graham's essays on how great Lisp is, and how Python is near to implementing features Lisp had in the 60's. Also found the concept of macros interesting. I've dabbled a bit with Lisp in school and I read most of the Wi

Re: [Tutor] Unexpected result from decimal

2005-01-21 Thread Jacob S.
Okay, so how do I get decimal to set precision of *significant digits*? Why have a decimal.getcontext().prec if it doesn't provide a useful result? The number of digits in a number is irrelevant to that numbers value. It just doesn't make sense to me. I tried quantize the other day and it didn't wo

Re: [Tutor] Unexpected result from decimal

2005-01-21 Thread Kent Johnson
Jacob S. wrote: Okay, so how do I get decimal to set precision of *significant digits*? That is exactly what it is doing. getcontext().prec sets how many digits are used to represent the mantissa of the number. Have you taken any physics classes? What is 1000/7 to two significant digits? It is 14

[Tutor] Importing multiple files as a single module?

2005-01-21 Thread Max Noel
Hi everyone, Having learnt OOP with C++, and most of my OOP experience being with Java, I'm used to storing my classes in one file for each class. I find it tidier and easier to read/debug. However, when I try to do the same in Python, each file corresponds to a module with a single class in i

Re: [Tutor] Importing multiple files as a single module?

2005-01-21 Thread Kent Johnson
I think this will work: in foo/__init__.py put from Bar import Bar from Baz import Baz or whatever variations of this you like. Any names defined in the package __init__.py are available to other code as package attribute. Kent Max Noel wrote: Hi everyone, Having learnt OOP with C++, and most

RE: [Tutor] Importing multiple files as a single module?

2005-01-21 Thread Ryan Davis
I'm having the same problem, and am eager to hear the responses. As far as a "real" IDE, emacs works pretty well, and check out Komodo, the ActiveState IDE: http://www.activestate.com/Products/Komodo/ Thanks, Ryan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] O

Re: [Tutor] Importing multiple files as a single module?

2005-01-21 Thread Danny Yoo
On Fri, 21 Jan 2005, Kent Johnson wrote: > I think this will work: > in foo/__init__.py put > from Bar import Bar > from Baz import Baz > > or whatever variations of this you like. > > Any names defined in the package __init__.py are available to other code > as package attribute. Hi Max, For

Re: [Tutor] Combination

2005-01-21 Thread Danny Yoo
On Fri, 21 Jan 2005, Guillermo Fernandez Castellanos wrote: > I'm trying to take a list and find all the unique combinations of that > list. > > I mean: > if I enter (1,2,3,4,5) and I watn combinations of 3, I want to find: > (1,2,3) but then not (2,1,3), (3,1,2),... > (1,2,4) > (1,2,5) > (2,3,5

Re: [Tutor] Combination

2005-01-21 Thread Danny Yoo
On Fri, 21 Jan 2005, Danny Yoo wrote: > > I mean: > > if I enter (1,2,3,4,5) and I watn combinations of 3, I want to find: > > (1,2,3) but then not (2,1,3), (3,1,2),... > > (1,2,4) > > (1,2,5) > > (2,3,5) > > (3,4,5) > > > There is a clean recursive way to define this. Hi Guillermo, Gaaa; I s

Re: [Tutor] Syntactical question / OT Lisp

2005-01-21 Thread Alan Gauld
> foo.py - > > import parrot > > class Bar(model.Background): > > def __initialize__(self, event): > #Just a pythoncard variant on init > self.config=self.loadCfg() > > >def loadCfg(): > #get some cfg stuff, return as dict > return cfgDict >

Re: [Tutor] Ooer, OT Lisp

2005-01-21 Thread Alan Gauld
> 1) Anyone here familiar with both? Yes at least two of us - DAnny has used Lisp/Scheme. > 2) If so, which would you rate as more powerful? Lisp by a long long way. Its more mature and has every bell and whistle going. Of course its much much harder to become an expert in Lisp for the same re

RE: [Tutor] Ooer, OT Lisp

2005-01-21 Thread John Purser
Very interesting sites. Thank you. John Purser -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Alan Gauld Sent: Friday, January 21, 2005 14:33 To: Liam Clarke; Tutor Tutor Subject: Re: [Tutor] Ooer, OT Lisp > 1) Anyone here familiar with both? Yes at

Re: [Tutor] Re: Fw: Please submit to tutor list: dictionary update prob

2005-01-21 Thread Jacob S.
Just one question... Why are you off the list? I see no point. If you want to stop getting the mail, you can change the options of your list account online... That's the only reason I see... Let's see -- reasons 1. Cost -- No, it's free 2. Security -- If you were subscribed to it once, it's too l

[Tutor] glob or filter help

2005-01-21 Thread Jay Loden
I have the following code in my updates script (gets the five most recent updated files on my site) def get_fles(exts, upd_dir): '''return list of all the files matching any extensions in list exts''' fle_list = [] for each in exts: cmd = upd_dir + "*." + each ext_ls = glob.glob(cmd) fl

[Tutor] read line x from a file

2005-01-21 Thread J. M. Strother
I have a text file containing 336 records. I can read and print out the whole file without any problem. What I want to do is read and print out one record only (chosen at random). So I need to get to record x, select it, and then print it (or store it in a variable). Can anyone tell me now to do

Re: [Tutor] read line x from a file

2005-01-21 Thread Orri Ganel
J. M. Strother wrote: I haveĀ  a text file containing 336 records. I can read and print out the whole file without any problem. What I want to do is read and print out one record only (chosen at random). So I need to get to record x, select it, and then print it (or store it in a variable)

Re: [Tutor] read line x from a file

2005-01-21 Thread Jay Loden
One simple solution is to do: fle = open(file) contents = file.readlines() file.close() print contents[x] #or store this in a variable, whatever -Jay On Friday 21 January 2005 11:22, J. M. Strother wrote: > I have a text file containing 336 records. > I can read and print out the whole file w

Re: [Tutor] read line x from a file

2005-01-21 Thread Orri Ganel
Jay Loden wrote: One simple solution is to do: fle = open(file) contents = file.readlines() file.close() print contents[x] #or store this in a variable, whatever -Jay On Friday 21 January 2005 11:22, J. M. Strother wrote: I have a text file containing 336 records. I can read

[Tutor] Re: glob or filter help

2005-01-21 Thread Javier Ruere
Jay Loden wrote: > I have the following code in my updates script (gets the five most recent > updated files on my site) > > def get_fles(exts, upd_dir): > '''return list of all the files matching any extensions in list exts''' > fle_list = [] > for each in exts: > cmd = upd_dir + "*." + ea