Re: [Tutor] global is bad but ...

2007-11-13 Thread Dinesh B Vadhia
Alan/Jim: It's good to hear some pragmatic advice. This particular module has 8 small functions that share common data (structures, primarily in arrays and vectors). I tried passing array_G as a parameter but that doesn't work because everything in the function remains local and I cannot ge

Re: [Tutor] [wxPython-users] Executing a python script in WxPython

2007-11-13 Thread Alan Gauld
"Varsha Purohit" <[EMAIL PROTECTED]> wrote > I have an application where i need to run a python script from > wxpython gui. I am calling the script from the button click event. > And > the moment button is pressed the python script should be executed. This comes up from time to time and is

Re: [Tutor] [wxPython-users] Executing a python script in WxPython

2007-11-13 Thread Varsha Purohit
Thanks for the help its working now !!! On Nov 13, 2007 7:34 PM, Kent Johnson <[EMAIL PROTECTED]> wrote: > Varsha Purohit wrote: > > Hello, > > I have an application where i need to run a python script from > > wxpython gui. I am calling the script from the button click event. And > > the mo

Re: [Tutor] [wxPython-users] Executing a python script in WxPython

2007-11-13 Thread Kent Johnson
Varsha Purohit wrote: > Hello, > I have an application where i need to run a python script from > wxpython gui. I am calling the script from the button click event. And > the moment button is pressed the python script should be executed. If you can import the script and call the required fun

Re: [Tutor] global is bad but ...

2007-11-13 Thread Michael H. Goldwasser
>> okay, i tried. so why are globals bad and what problems >> do they solve? The biggest complaint I have with the original example is that you've writen code to "do stuff" with array G, yet that code cannot directly be used to do the same stuff to some other array. In this sense, th

Re: [Tutor] Maya anyone?

2007-11-13 Thread Kent Johnson
Da'Nivek wrote: > Hey there, > > I'm trying to learn python to use in Maya > Would it be appropriate to post a question here? You can certainly post a question...if it is too Maya-specific you may have better luck on a Maya list. We are good at Python, maybe not so good at Maya. Kent

Re: [Tutor] global is bad but ...

2007-11-13 Thread Kent Johnson
jim stockford wrote: > okay, i tried. so why are globals bad and what problems > do they solve? Wikipedia has a decent list: http://en.wikipedia.org/wiki/Global_variable Kent ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/lis

[Tutor] [wxPython-users] Executing a python script in WxPython

2007-11-13 Thread Varsha Purohit
Hello, I have an application where i need to run a python script from wxpython gui. I am calling the script from the button click event. And the moment button is pressed the python script should be executed. thanks, Varsha Purohit, Graduate Student ___

Re: [Tutor] global is bad but ...

2007-11-13 Thread wesley chun
> okay, i tried. so why are globals bad and what problems > do they solve? now, my OS theory may be a bit rusty -- pls correct me where i'm wrong, but from what i recall, one reason they're bad is because they take up "unneeded" amount of memory. in a traditional stack model -- think C, assem

Re: [Tutor] NumPy Question - numpy.put in multi-dimensional array

2007-11-13 Thread Bryan Fodness
Thank you. That works great! On Nov 13, 2007 7:18 PM, Eike Welk <[EMAIL PROTECTED]> wrote: > Hello Bryan! > > On Wednesday 14 November 2007 00:18, Bryan Fodness wrote: > > I see how to do it in a one-dimenstional array, but do not know the > > syntax for the multi-dimensional case. > > > > >from

Re: [Tutor] NumPy Question - numpy.put in multi-dimensional array

2007-11-13 Thread Eike Welk
Hello Bryan! On Wednesday 14 November 2007 00:18, Bryan Fodness wrote: > I see how to do it in a one-dimenstional array, but do not know the > syntax for the multi-dimensional case. > > >from numpy import * > > a = zeros((60,40), int) > > fields = {} > field = 10 > fields[field] = '30A', 5 > > iy

Re: [Tutor] global is bad but ...

2007-11-13 Thread jim stockford
On Nov 13, 2007, at 3:11 PM, Alan Gauld wrote: > Rather than answer your question directly can I ask, do > you know *why* wiser heads say global is bad? What > problems does using global introduce? What problems > does it solve? i'll try: globals are good because they provide common data to

Re: [Tutor] Error: 'module' object is not callable

2007-11-13 Thread Ajaya Mohan R. S.
Hi, Thanks. I have used the following code http://www.ipsl.jussieu.fr/~jmesce/Taylor_diagram/Miscelaneous/model_vs_data_comp_stat.py ajay --- Alan Gauld <[EMAIL PROTECTED]> wrote: > "Ajaya Mohan R. S." <[EMAIL PROTECTED]> wrote > > > I am trying to run a code for plotting Taylor > diagra

Re: [Tutor] Error: 'module' object is not callable

2007-11-13 Thread Alan Gauld
"Ajaya Mohan R. S." <[EMAIL PROTECTED]> wrote > I am trying to run a code for plotting Taylor diagram, > ending up with the following errors. How do I fix > these errors? Help appreciated. Without any sight of the code that caused them its hard to give sensible answers. We can only suggest gene

[Tutor] NumPy Question - numpy.put in multi-dimensional array

2007-11-13 Thread Bryan Fodness
I see how to do it in a one-dimenstional array, but do not know the syntax for the multi-dimensional case. from numpy import * a = zeros((60,40), int) fields = {} field = 10 fields[field] = '30A', 5 iy = int(fields[field][1]) ix = int(fields[field][0].rstrip('AB')) for j in range(iy): pu

Re: [Tutor] [tutor] File format conversion

2007-11-13 Thread Varsha Purohit
Hello Alan, It is a file having colour data grid.. just like any simple ascii file and i need to manipulate the numbers with colours. But at this stage i am not much bothered with colurs i can associate it with simple RGB value for all different numbers. ex. of such simple file can be like thi

Re: [Tutor] global is bad but ...

2007-11-13 Thread Alan Gauld
"Dinesh B Vadhia" <[EMAIL PROTECTED]> wrote > Consider a data structure (say, an array) that is operated > on by a bunch of functions eg. > > def function_A > global array_G > def function_B > global array_G > etc... > On the other hand, wiser heads say that the use of 'global' > is b

[Tutor] Maya anyone?

2007-11-13 Thread Da'Nivek
Hey there, I'm trying to learn python to use in Maya Would it be appropriate to post a question here? thanks Nivek 3D Artist Kevin Nield http://www.kevinnield.com AIM: nanoennui

[Tutor] subprocess help, nohup

2007-11-13 Thread John
Hello, I've written a script which conducts several subprocess calls and then ultimately calls a shell script which runs even more programs... my script is using subprocess to execute a few sed calls, and then execute the script. I'm getting strange behavior: Here's a snippet of my script (any ge

[Tutor] Error: 'module' object is not callable

2007-11-13 Thread Ajaya Mohan R. S.
Hi, I am trying to run a code for plotting Taylor diagram, ending up with the following errors. How do I fix these errors? Help appreciated. best, Ajay Read observation data... Read 'mri_cgcm2_3_2a' model output... Compute comparison statistics... Error treating model: mri_cgcm2_3_2a Error: 'modu

Re: [Tutor] NNTP Client

2007-11-13 Thread Stephen Nelson-Smith
On Nov 13, 2007 4:01 PM, Stephen Nelson-Smith <[EMAIL PROTECTED]> wrote: > >>> server = NNTP('news.gmane.org') > > What's wrong with that then? server, apparently:>>> s.group("gmane.discuss") ('211 11102 10 11329 gmane.discuss', '11102', '10', '11329', 'gmane.discuss') >>> server.group("gmane.disc

Re: [Tutor] global is bad but ...

2007-11-13 Thread Eric Brunson
Kent Johnson wrote: > Dinesh B Vadhia <[EMAIL PROTECTED]> wrote: > >> Consider a data structure (say, an array) that is operated on by a bunch of >> functions >> >> The described way is to place the statement 'global' in line 1 of each >> function. On the other hand, wiser heads say tha

Re: [Tutor] global is bad but ...

2007-11-13 Thread Kent Johnson
Dinesh B Vadhia <[EMAIL PROTECTED]> wrote: > Consider a data structure (say, an array) that is operated on by a bunch of > functions > > The described way is to place the statement 'global' in line 1 of each > function. On the other hand, wiser heads say that the use of 'global' is bad

[Tutor] global is bad but ...

2007-11-13 Thread Dinesh B Vadhia
Consider a data structure (say, an array) that is operated on by a bunch of functions eg. def function_A global array_G do stuff with array_G return def function_B global array_G do stuff with array_G return def function_C global array_G do stuff with array_G

Re: [Tutor] NNTP Client

2007-11-13 Thread Stephen Nelson-Smith
On Nov 13, 2007 2:13 PM, Stephen Nelson-Smith <[EMAIL PROTECTED]> wrote: > ought it to be straightforward to write a client that does this task? Well: >>> server = NNTP('news.gmane.org') >>> resp, count, first, last, name = server.group("gmane.linux.redhat.enterprise.announce") Traceback (most r

[Tutor] NNTP Client

2007-11-13 Thread Stephen Nelson-Smith
Hello all, I wish to pull all the articles for one particular newsgroup to a local machine, on a regular basis. I don't wish to read them - I will be parsing the contents programatically. In your view is it going to be best to use an 'off-the-shelf' news reader, or ought it to be straightforward

Re: [Tutor] parsing an array

2007-11-13 Thread Aditya Lal
On Nov 13, 2007 7:06 PM, bob gailer <[EMAIL PROTECTED]> wrote: > Aditya Lal wrote: > > [snip] > > > for i in a[:] will make i point to the elements of the list > To be more precise: > a[:] is a copy of the list > the for statement assigns each list element in turn to i. Assign is not > exactly the

Re: [Tutor] parsing an array

2007-11-13 Thread bob gailer
Aditya Lal wrote: > [snip] > for i in a[:] will make i point to the elements of the list To be more precise: a[:] is a copy of the list the for statement assigns each list element in turn to i. Assign is not exactly the same as point. ___ Tutor maillis

Re: [Tutor] Tkinter Canvas Widget

2007-11-13 Thread Alan Gauld
"Johnston Jiaa" <[EMAIL PROTECTED]> wrote > methods.html>, but do not see how to get the coordinates of the > mouse > on the canvas. Any mouse event will give you the coordinates within the event data. Trapping the mouse Movment will ensure you track the current position, > Also, after I get t

Re: [Tutor] manipulating data

2007-11-13 Thread Alan Gauld
"Bryan Fodness" <[EMAIL PROTECTED]> > f = open('TEST1.MLC') > fields = {} > for line in f: > the_line = line.split() > if the_line: >if the_line[0] == 'Field': > field = int(the_line[-1]) >elif the_line[0] == 'Leaf': > fields[field] = the_line[-1] > > which, sort of works, b