Re: [Tutor] BLAS Implementation on Python

2011-03-25 Thread Mahesh Narayanamurthi
Thank you all for your replies. I wonder why I din't get any updates from the mailing list. Now I feel I have more reasons to proceed with the implementation. Only that I don't know where to start :) Thanks, Mahesh Narayanamurthi ___ Tutor maillist -

Re: [Tutor] Recursively flatten the list

2011-03-25 Thread Prasad, Ramit
" A more important problem is that it is flattening only one level. Multi-level flattening is I think not possible without using some kind of recursion." Not true, just requires more iterations to check each element. Each iteration could check if every element is a list and then unpack if it is a

Re: [Tutor] script conversion windows -> linux error

2011-03-25 Thread Rance Hall
On Fri, Mar 25, 2011 at 1:54 PM, Walter Prins wrote: > > > On 25 March 2011 18:26, Rance Hall wrote: >> >> config_version =  config.get('versions','configver',0) >> >> This line fails under 3.2 Linux with the error message: >> >> TypeError:  get() takes exactly 3 positional arguments (4 given) >>

[Tutor] un-buffered web output

2011-03-25 Thread ian douglas
Hey List, In Perl, I can manipulate a special variable called $| to control buffered output, even on web pages, so I can watch something run (like CGI processes reading files or running system commands) as Perl processes it (pseudo real-time), as opposed to languages like PHP which buffers al

Re: [Tutor] script conversion windows -> linux error

2011-03-25 Thread Joel Goldstick
have you tried help(config.get) in the python interactive shell? -- Joel Goldstick ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] script conversion windows -> linux error

2011-03-25 Thread Walter Prins
Ugh, please excuse my tardiness and ignore the numbered items below my signature which I was intending to delete, I accidentally hit "end" before I cleaned up the post... :red faced: ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscri

Re: [Tutor] script conversion windows -> linux error

2011-03-25 Thread Walter Prins
On 25 March 2011 18:26, Rance Hall wrote: > config_version = config.get('versions','configver',0) > > This line fails under 3.2 Linux with the error message: > > TypeError: get() takes exactly 3 positional arguments (4 given) > > What could the 4th argument be? I only see three. > > This same

[Tutor] script conversion windows -> linux error

2011-03-25 Thread Rance Hall
I wrote a script on a windows box for python 3.1 after a meeting with the client for this project we agreed to port it to Linux so that I could make use of enscript and ps2pdf to email customers documents right from the script. Client uses a Centos server so I did some reading and installed pytho

Re: [Tutor] if value not in dictionary, do a?

2011-03-25 Thread Blockheads Oi Oi
On 25/03/2011 16:11, Robert Sjoblom wrote: I received your email just as I left my computer, and didn't want to type out an answer on my phone (because smartphones aren't smart enough for that yet), and my first reaction was "why?" followed by "I need my program to continue even if I get the err

Re: [Tutor] if value not in dictionary, do a?

2011-03-25 Thread Hugo Arts
On Fri, Mar 25, 2011 at 5:11 PM, Robert Sjoblom wrote: > -- Hugo Arts wrote -- > >>Why are you asking for the user to enter a key? you're iterating over >>all keys in the dictionary, so there's no need to ask the user for >>keys, you already know them. Why not do this: > >>b = int(input("Enter val

Re: [Tutor] if value not in dictionary, do a?

2011-03-25 Thread Robert Sjoblom
-- Hugo Arts wrote -- >Why are you asking for the user to enter a key? you're iterating over >all keys in the dictionary, so there's no need to ask the user for >keys, you already know them. Why not do this: >b = int(input("Enter value for key %s: " % key)) >dictionary[key] = b I have a great an

[Tutor] Tutoring

2011-03-25 Thread bob gailer
I have recently become a tutor to several Python students. I enjoy tutoring and they benefit from it. I work with some students using remote access, so we can be geographically far apart. Who do you know who might benefit from receiving one-on-one tutoring? -- Bob Gailer 919-636-4239 Cha

Re: [Tutor] if value not in dictionary, do a?

2011-03-25 Thread James Reynolds
On Fri, Mar 25, 2011 at 7:52 AM, Robert Sjoblom wrote: > Hi again, list! A quick question about dictionary behaviour. I have a > dictionary of keys, and the user should be able to enter values into > said dictionary. My idea was this: > > def addData(key, value): >dictionary[key] += int(value)

Re: [Tutor] if value not in dictionary, do a?

2011-03-25 Thread Rafael Durán Castañeda
In addition I think defaultdict doesn't avoid neither entering negatives nor something that isn't an integer, you could try something like this: >>> dictionary = {} >>> for _ in range(4): key = input("Enter key: ") value = 0 while value <= 0: try: value = int(input(

Re: [Tutor] if value not in dictionary, do a?

2011-03-25 Thread Hugo Arts
On Fri, Mar 25, 2011 at 12:52 PM, Robert Sjoblom wrote: > Hi again, list! A quick question about dictionary behaviour. I have a > dictionary of keys, and the user should be able to enter values into > said dictionary. My idea was this: > > def addData(key, value): >    dictionary[key] += int(value

Re: [Tutor] if value not in dictionary, do a?

2011-03-25 Thread col speed
I am a newbie too, but from collections import defaultdict Then you can do: data = defaultdict(int) Everything (all keys) start at 0, so you can do "+=" with no problem. I'm sure somebody else has a better solution though! Cheers Colin On 25 March 2011 18:52, Robert Sjoblom wrote: > Hi ag

[Tutor] if value not in dictionary, do a?

2011-03-25 Thread Robert Sjoblom
Hi again, list! A quick question about dictionary behaviour. I have a dictionary of keys, and the user should be able to enter values into said dictionary. My idea was this: def addData(key, value): dictionary[key] += int(value) return None dictionary = {"a":0, "b":0, "c":0, "d":0} for k

Re: [Tutor] Tutor Digest, Vol 85, Issue 91

2011-03-25 Thread Steven D'Aprano
Lea Parker wrote: Message 3 - I solved my problem. Yah Me!!! Thanks P.S I hope this is the right way to let you know so you don't waste your time. Hi Lea, glad you solved the problem, and welcome. For the future though, when replying to a digest, you should edit the subject line to be so