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

2009-06-09 Thread Gonzalo Garcia-Perate
Kent thanks again for your input, rest assured is just the haste of my responses that goes unchecked :) many thanks, Gonzalo. 2009/6/9 Kent Johnson : > On Mon, Jun 8, 2009 at 12:56 PM, Gonzalo > Garcia-Perate wrote: >> Kent, Emile thank you both. You're absolutely right

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

2009-06-08 Thread Gonzalo Garcia-Perate
Kent, Emile thank you both. You're absolutely right, I was going for range because I thought it made the code more readable/more explicit. I hadn't taken into account the performance hit of creating the list and iterating through it. I'm not sure it was more readable either. the function now reads

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

2009-06-07 Thread Gonzalo Garcia-Perate
9/6/7 Kent Johnson : > On Sun, Jun 7, 2009 at 10:08 AM, Gonzalo > Garcia-Perate wrote: >>  the solution laid somewhere in between: >> >> def within_range(self, n, n2, threshold=5): >>        if n in range(n2-threshold, n2+threshold+1) and n < >> n2+threshold or

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

2009-06-07 Thread Gonzalo Garcia-Perate
2009/6/6 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 o

[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] module paths

2008-07-06 Thread Gonzalo Garcia-Perate
ok I fixed it. I removed 2.4 and re-linked /usr/local/bin/python to /Library/Frameworks/Python.framework/Versions/Current/bin/python thanks! 2008/7/6 Gonzalo Garcia-Perate <[EMAIL PROTECTED]>: > That's what I thought but no. There is an install of 2.4 but not in > use. /usr

Re: [Tutor] module paths

2008-07-05 Thread Gonzalo Garcia-Perate
> I copy/pasted your script and it ran fine on my end. Is it possible that > you've got more than one installation of python and the feedparser module is > installed somewhere other than for the python interpreter at > /usr/local/bin/python (since that's what your script references

[Tutor] module paths

2008-07-05 Thread Gonzalo Garcia-Perate
I'm looking at python after a long time. I wanted to build a quick parser for some rss feeds and have started using feedparser. When I test my code on the python interactive shell things work fine but when I try to write it into a file I get the following error: AttributeError: 'module' object has