Re: Confused: Newbie Function Calls

2010-08-30 Thread Stefan Schwarzer
Hi Pinku, On 2010-08-11 21:35, Pinku Surana wrote: > Even though I used the same name "x" for a local and global variable, > they are actually completely different. When I call "fun(x)" it COPIES > the global value of "x" into the local variable "x" in "fun". [...] The global value isn't copied w

Re: Confused: Newbie Function Calls

2010-08-27 Thread Aahz
In article <2dd74ab4-5ed6-40ac-aea7-705977b61...@g21g2000prn.googlegroups.com>, fuglyducky wrote: > >I am a complete newbie to Python (and programming in general) and I >have no idea what I'm missing. Below is a script that I am trying to >work with and I cannot get it to work. Side note: while

Re: Confused: Newbie Function Calls

2010-08-11 Thread Pinku Surana
On Aug 11, 12:39 pm, fuglyducky wrote: > On Aug 11, 9:31 am, Pinku Surana wrote: > > > > > > > On Aug 11, 12:07 pm, fuglyducky wrote: > > > > I am a complete newbie to Python (and programming in general) and I > > > have no idea what I'm missing. Below is a script that I am trying to > > > work

Re: Confused: Newbie Function Calls

2010-08-11 Thread Terry Reedy
Rather than patch your code, I think you should see a better approach. from textwrap import dedent # removes common whitespace prefix lines = [] def add_header(ss): "Add header to sequence of string lines" ss.append(dedent("""\ # No initial blank line my multi-line string here

Re: Confused: Newbie Function Calls

2010-08-11 Thread Dave Angel
fuglyducky wrote: I am a complete newbie to Python (and programming in general) and I have no idea what I'm missing. Below is a script that I am trying to work with and I cannot get it to work. When I call the final print function, nothing prints. However, if I print within the individual functio

Re: Confused: Newbie Function Calls

2010-08-11 Thread EW
On Aug 11, 12:39 pm, fuglyducky wrote: > On Aug 11, 9:31 am, Pinku Surana wrote: > > > > > > > On Aug 11, 12:07 pm, fuglyducky wrote: > > > > I am a complete newbie to Python (and programming in general) and I > > > have no idea what I'm missing. Below is a script that I am trying to > > > work

Re: Confused: Newbie Function Calls

2010-08-11 Thread Jean-Michel Pichavant
fuglyducky wrote: I am a complete newbie to Python (and programming in general) and I have no idea what I'm missing. Below is a script that I am trying to work with and I cannot get it to work. When I call the final print function, nothing prints. However, if I print within the individual functio

Re: Confused: Newbie Function Calls

2010-08-11 Thread Wieland Hoffmann
On 11.08.2010 18:07, fuglyducky wrote: > Am I missing something??? Thanks in advance Assign the returned value of your functions to something (like sample_string) and it will work: > > # Global variable > sample_string = "" > > def gen_header(sa

Re: Confused: Newbie Function Calls

2010-08-11 Thread fuglyducky
On Aug 11, 9:31 am, Pinku Surana wrote: > On Aug 11, 12:07 pm, fuglyducky wrote: > > > > > I am a complete newbie to Python (and programming in general) and I > > have no idea what I'm missing. Below is a script that I am trying to > > work with and I cannot get it to work. When I call the final

Re: Confused: Newbie Function Calls

2010-08-11 Thread EW
This will work: sample_string="" def gen_header(sample_string=""): HEADER = """ mymultilinestringhere """ sample_string+= HEADER return sample_string def gen_nia(sample_string=""): NIA = """ ano

Re: Confused: Newbie Function Calls

2010-08-11 Thread Pinku Surana
On Aug 11, 12:07 pm, fuglyducky wrote: > I am a complete newbie to Python (and programming in general) and I > have no idea what I'm missing. Below is a script that I am trying to > work with and I cannot get it to work. When I call the final print > function, nothing prints. However, if I print w

Re: Confused: Newbie Function Calls

2010-08-11 Thread Robert Kern
On 8/11/10 11:07 AM, fuglyducky wrote: I am a complete newbie to Python (and programming in general) and I have no idea what I'm missing. Below is a script that I am trying to work with and I cannot get it to work. When I call the final print function, nothing prints. However, if I print within t

Re: Confused: Newbie Function Calls

2010-08-11 Thread Michael Torrie
On 08/11/2010 10:07 AM, fuglyducky wrote: > I am a complete newbie to Python (and programming in general) and I > have no idea what I'm missing. Below is a script that I am trying to > work with and I cannot get it to work. When I call the final print > function, nothing prints. However, if I print