Re: [Tutor] Need better understanding of **kwargs

2009-06-06 Thread wesley chun
>> Hello, I thought I understood **kwargs until I stumbled with this >> function: >> >> def changeflexion(myword, mytag, **dicty): >>: >> >> but when I import the module and call: >> a = conjugate.changeflexion('estaban', 'VLFin', conjugate.mydict) >> I get this error: >> TypeError: changef

Re: [Tutor] converting xls to csv

2009-06-06 Thread Kent Johnson
On Sat, Jun 6, 2009 at 5:37 PM, Nick Burgess wrote: > Thanks everyone, the following code works great.  It returns the name > of the file and the row that matched the reqex.  Is it posible to take > the regex compile from user input?  To make it take an argument,  like > >> csvSearch.py 10.192.55 >

Re: [Tutor] gui problem

2009-06-06 Thread Kent Johnson
Can you try that again? Kent On Sat, Jun 6, 2009 at 4:20 PM, Essah Mitges wrote: > > from math import sin, cos, pi import pygame displayWidth = 640displayHeight > = 480fpsLimit = 90 def sinInterpolation(start, end, steps=30):    values = > [start]    delta = end - start    for i in range(1, steps

Re: [Tutor] python workspace

2009-06-06 Thread Dave Kuhlman
On Tue, Jun 02, 2009 at 04:40:43PM -0500, W W wrote: > >On Tue, Jun 2, 2009 at 1:30 PM, Dave Angel <[1]da...@ieee.org> wrote: > > You could use the commercial Komodo IDE. It's got a debugger that > runs the Python code as a separate process, so it can be used for > GUI debuggi

Re: [Tutor] creating a range above & below a given number

2009-06-06 Thread Alan Gauld
"Gonzalo Garcia-Perate" wrote Hello tutor, What's the simplest way of creating a list with a range of numbers above and below a given number? ... this works fine, but is there a simpler way of doing it? a one liner? :) I'd probably use a list comprehesion: L = [n for n in range(lower, uppe

Re: [Tutor] converting xls to csv

2009-06-06 Thread Sander Sweers
2009/6/6 Nick Burgess : > Is it posible to take > the regex compile from user input?  To make it take an argument,  like > >> csvSearch.py 10.192.55 You can use raw_inpout() see [1] for the docs user_input = raw_input('Please provide input') Greets Sander [1] http://docs.python.org/library/fun

Re: [Tutor] converting xls to csv

2009-06-06 Thread Nick Burgess
Thanks everyone, the following code works great. It returns the name of the file and the row that matched the reqex. Is it posible to take the regex compile from user input? To make it take an argument, like > csvSearch.py 10.192.55 af = re.compile(sys.argv[1]) pattern = re.compile(af)

Re: [Tutor] converting xls to csv

2009-06-06 Thread Sander Sweers
2009/6/6 Emile van Sebille : >> for f in files: >>    print f >>    csv.reader(open (f), delimiter=' ', quotechar='|') > > you open it here, but don't save a reference to the opened file.  Try... >      ff = csv.reader(open (f), delimiter=' ', quotechar='|') >    reader(...) >        csv_reader

[Tutor] gui problem

2009-06-06 Thread Essah Mitges
from math import sin, cos, pi import pygame displayWidth = 640displayHeight = 480fpsLimit = 90 def sinInterpolation(start, end, steps=30):values = [start]delta = end - startfor i in range(1, steps):n = (pi / 2.0) * (i / float(steps - 1))values.append(start + delta *

Re: [Tutor] converting xls to csv

2009-06-06 Thread Emile van Sebille
On 6/6/2009 1:07 PM Nick Burgess said... f seems to be a string containing the file names, so csv.reader isnt actually opening them.. maybe i will play with os.walk..? files = glob.glob("*.csv") Almost there... for f in files: print f csv.reader(open (f), delimiter=' ', quotechar='

Re: [Tutor] creating a range above & below a given number

2009-06-06 Thread Emile van Sebille
On 6/6/2009 12:31 PM Gonzalo Garcia-Perate said... Hello tutor, What's the simplest way of creating a list with a range of numbers above and below a given number? see the function below: def within_range( self, number, median, threshold=5 ): # build a list of (threshold) numbers abo

Re: [Tutor] converting xls to csv

2009-06-06 Thread Nick Burgess
f seems to be a string containing the file names, so csv.reader isnt actually opening them.. maybe i will play with os.walk..? files = glob.glob("*.csv") for f in files: print f csv.reader(open (f), delimiter=' ', quotechar='|') for row in f: for cell in row: if p

Re: [Tutor] converting xls to csv

2009-06-06 Thread Emile van Sebille
On 6/6/2009 12:19 PM Nick Burgess said... Thank you. The data is pretty much random throughout the csv's so I think I it would have to iterate over the entire rows . I need to search all .csv files in the current directory. I can get glob to return a list of files. How could I get csv.reader

[Tutor] creating a range above & below a given number

2009-06-06 Thread Gonzalo Garcia-Perate
Hello tutor, What's the simplest way of creating a list with a range of numbers above and below a given number? see the function below: def within_range( self, number, median, threshold=5 ): # build a list of (threshold) numbers above and below median range_list = range( media

Re: [Tutor] converting xls to csv

2009-06-06 Thread Nick Burgess
Thank you. The data is pretty much random throughout the csv's so I think I it would have to iterate over the entire rows . I need to search all .csv files in the current directory. I can get glob to return a list of files. How could I get csv.reader to open all the files in the list? My loop

Re: [Tutor] Need better understanding of **kwargs

2009-06-06 Thread Mark Tolonen
"Eduardo Vieira" wrote in message news:9356b9f30906061044i4ded250fif3b387e64a117...@mail.gmail.com... Hello, I thought I understood **kwargs until I stumbled with this function: def changeflexion(myword, mytag, **dicty): global er_verbs global ar_verbs global ir_verbs #global di

Re: [Tutor] Need better understanding of **kwargs

2009-06-06 Thread bob gailer
Eduardo Vieira wrote: Hello, I thought I understood **kwargs until I stumbled with this function: def changeflexion(myword, mytag, **dicty): global er_verbs global ar_verbs global ir_verbs #global dicty for item in dicty: if myword in item and mytag in item[1]:

[Tutor] Need better understanding of **kwargs

2009-06-06 Thread Eduardo Vieira
Hello, I thought I understood **kwargs until I stumbled with this function: def changeflexion(myword, mytag, **dicty): global er_verbs global ar_verbs global ir_verbs #global dicty for item in dicty: if myword in item and mytag in item[1]: if dicty[item].end

Re: [Tutor] class design

2009-06-06 Thread ALAN GAULD
> In simple terms I was trying to create a 'folder with a view' which > displays all the data it contains on one page, rather than having to > view each node individually. In that case I'd probably create a FolderView class with a show or display method. If you want to do something with the c

Re: [Tutor] Suggested source code folder layout

2009-06-06 Thread Walker Hale IV
On Tue, Jun 2, 2009 at 5:06 PM, Allen Fowler wrote: > > Hello, > > I'm looking for some suggestions as to the filesystem source code layout for > a new project. > > Here is what I am thinking so far: > > root_folder/ > - app/ -- Code for our pylons/django/TG/etc web app > - web/ -- Public static

Re: [Tutor] class design

2009-06-06 Thread Kent Johnson
On Sat, Jun 6, 2009 at 10:43 AM, Norman Khine wrote: > http://docs.hforge.org/itools/web.html although this is for the newer > version, in my case i am maintaining an older version. >From that page it seems that itools does as I suggest. They claim to follow the Model-View-Controller pattern which

Re: [Tutor] class design

2009-06-06 Thread Norman Khine
http://docs.hforge.org/itools/web.html although this is for the newer version, in my case i am maintaining an older version. On Sat, Jun 6, 2009 at 3:24 PM, Kent Johnson wrote: > On Sat, Jun 6, 2009 at 8:26 AM, Norman Khine wrote: > >>> You probably don't want the view code in the same class with

Re: [Tutor] class design

2009-06-06 Thread Kent Johnson
On Sat, Jun 6, 2009 at 8:26 AM, Norman Khine wrote: >> You probably don't want the view code in the same class with the data. >> It's generally a good idea to separate the model - the representation >> of data - from the view - the display of the data. > > In iTools, each class has a view, edit, s

Re: [Tutor] class design

2009-06-06 Thread Norman Khine
Hi On Sat, Jun 6, 2009 at 2:38 PM, Alan Gauld wrote: > > "Norman Khine" wrote > >> In my application I have 3 folders each containing images, something like: >> >> $ tree -L 3 /database/companies/company/ >> |-- product >> |   |-- itinerary >> |   |   |-- img1.gif >> |   |   |-- img1.gif.metadata

Re: [Tutor] class design

2009-06-06 Thread Alan Gauld
"Norman Khine" wrote In my application I have 3 folders each containing images, something like: $ tree -L 3 /database/companies/company/ |-- product | |-- itinerary | | |-- img1.gif | | |-- img1.gif.metadata | | |-- day1 | | | |-- img2.gif | | | `-- img2.gif.metadat

Re: [Tutor] class design

2009-06-06 Thread Norman Khine
Thanks for the reply. I am using the iTools python library from http://hforge.org (http://git.hforge.org/) and the data is stored as XML files. On Sat, Jun 6, 2009 at 1:02 PM, Kent Johnson wrote: > On Sat, Jun 6, 2009 at 5:04 AM, Norman Khine wrote: >> Hello, >> I would like help to design the fol

Re: [Tutor] class design

2009-06-06 Thread Kent Johnson
On Sat, Jun 6, 2009 at 5:04 AM, Norman Khine wrote: > Hello, > I would like help to design the following: > http://paste.lisp.org/display/81448 Product.get_days() may have a bug, it only returns the first container it finds. You probably don't want the view code in the same class with the data. I

[Tutor] class design

2009-06-06 Thread Norman Khine
Hello, I would like help to design the following: In my application I have 3 folders each containing images, something like: $ tree -L 3 /database/companies/company/ |-- product | |-- itinerary | | |-- img1.gif | | |-- img1.gif.metadata | | |-- day1 | | | |-- img2.gif | |