Re: [Tutor] trying to change the number of elements in array whilepreserving data

2008-06-04 Thread Alan Gauld
"Bryan Fodness" <[EMAIL PROTECTED]> wrote but I would like to change b to look like this, [[0 0 0 0 0 0 0 0 0] [0 0 3 3 3 3 3 0 0] [0 0 3 3 3 3 3 0 0] My data will not be regular like these. I have a 400x60 array with irregular data that I would like as a 400x400 array. I'm not quite sure

[Tutor] [Fwd: Re: Intercepting methods calls]

2008-06-04 Thread Marilyn Davis
I keep forgetting to reply-to the list. I wish it was the default. On Wed, June 4, 2008 11:21 am, Andreas Kostyrka wrote: > Simple (untested in the mailer typed): > > > class A: def __getattr__(self, key): if key.startswith("user"): def func(): > return key[4:] return func raise AttributeError >

[Tutor] trying to change the number of elements in array while preserving data

2008-06-04 Thread Bryan Fodness
I tried posting this to numpy, but my posts never show up. So, I was hoping someone here might be able to help me. I have two arrays that are different sizes and i would like to be able to add them for plotting. If I have an array a and b, [[1 2 3 4 5 6 7 8 9] [1 2 3 4 5 6 7 8 9] [1 2 3 4 5 6 7

Re: [Tutor] thread.error: can't start new thread

2008-06-04 Thread Kent Johnson
On Wed, Jun 4, 2008 at 2:21 PM, Mohit Jain <[EMAIL PROTECTED]> wrote: > Hello guys, > > I am new to python (started programming a week back). I am trying to run a > piece of text analysis code over a database which contain more than > 10,000,00 rows. I decided to run the program in a threaded way.

Re: [Tutor] thread.error: can't start new thread

2008-06-04 Thread Alan Gauld
"Mohit Jain" <[EMAIL PROTECTED]> wrote I am new to python (started programming a week back). I assume from what follows that you are not new to programming and have experience of threads in other languages(maybe Java?) If not and you are new to programming then back off from threads for now!

Re: [Tutor] Intercepting methods calls

2008-06-04 Thread Alan Gauld
"Marilyn Davis" <[EMAIL PROTECTED]> wrote > Great question, Alan. But, whatever the answer, I'd like to see > the > variations listed, if you have time. Well, let's start the ball rolling then. __getattribute__ __getattr__ Metaclasses decorators properties __init__ The basic working is that

Re: [Tutor] turbo gears

2008-06-04 Thread Alan Gauld
"Sean Novak" <[EMAIL PROTECTED]> wrote I was curious as to what the you pythonistas thought about Turbo Gears. I've been moving through a pretty good book on the subject. If its the Prentice Hall one then I've read that too. Its OK but has a few errors in it. But TurboGears is well proven alb

[Tutor] thread.error: can't start new thread

2008-06-04 Thread Mohit Jain
Hello guys, I am new to python (started programming a week back). I am trying to run a piece of text analysis code over a database which contain more than 10,000,00 rows. I decided to run the program in a threaded way. So i created a thread pool. However, code gives me the error thread.error: can

Re: [Tutor] Intercepting methods calls

2008-06-04 Thread Andreas Kostyrka
Simple (untested in the mailer typed): class A: def __getattr__(self, key): if key.startswith("user"): def func(): return key[4:] return func raise AttributeError assert A().userabc() == "abc" Something like that? On Wednesd

Re: [Tutor] Grabbing data from changing website

2008-06-04 Thread James
Thanks for the prompt reply, Kent! On Wed, Jun 4, 2008 at 10:26 AM, Kent Johnson <[EMAIL PROTECTED]> wrote: > On Wed, Jun 4, 2008 at 10:00 AM, James <[EMAIL PROTECTED]> wrote: > >> Is there a good module to 'grab' data from a page and dump it into a >> data structure? The parsing will likely be ra

Re: [Tutor] Grabbing data from changing website

2008-06-04 Thread Kent Johnson
On Wed, Jun 4, 2008 at 10:00 AM, James <[EMAIL PROTECTED]> wrote: > Is there a good module to 'grab' data from a page and dump it into a > data structure? The parsing will likely be rather easy. :) urllib2 will grab the HTML. BeautifulSoup will parse it and allow fairly easy access. My writeup on

[Tutor] Grabbing data from changing website

2008-06-04 Thread James
All, I'd like to write a script that parses through a website that constantly changes (i.e., stock prices listed on a flat html page). Is there a good module to 'grab' data from a page and dump it into a data structure? The parsing will likely be rather easy. :) Many thanks. :) - james _

Re: [Tutor] turbo gears

2008-06-04 Thread Kent Johnson
On Wed, Jun 4, 2008 at 7:53 AM, Sean Novak <[EMAIL PROTECTED]> wrote: > I was curious as to what the you pythonistas thought about Turbo Gears. > > At first, I'm feeling completely naked without PHP, MySQL, and Apache. I > guess I'm looking for reassurance that I'm doing the right thing.. ie. > ap

[Tutor] turbo gears

2008-06-04 Thread Sean Novak
I was curious as to what the you pythonistas thought about Turbo Gears. I've been moving through a pretty good book on the subject. But, I thought I would get some opinions before really committing a lot of time to learning their workflow. I am writing web apps, which is what drew me to

Re: [Tutor] create numpy array from list of strings

2008-06-04 Thread Kent Johnson
On Tue, Jun 3, 2008 at 10:35 PM, washakie <[EMAIL PROTECTED]> wrote: > I guess I assumed there would be a way to 'nest' list > comprehension somehow. Sure, just nest them. You have: tempDATA=[] for i in data[stind:-1]: tempDATA.append([float(j) for j in i.split()]) This has the form tem

Re: [Tutor] Intercepting methods calls

2008-06-04 Thread Andreas Kostyrka
On Wednesday 04 June 2008 07:41:49 Marilyn Davis wrote: > On Tue, June 3, 2008 10:16 pm, Alan Gauld wrote: > > "Laureano Arcanio" <[EMAIL PROTECTED]> wrote > > > >> Is there any way to intercept calls to methods ? like the > >> __setattribute__ > >> medthod does ? > > > > There are several variatio