Re: why is this not working? (nested scope question)

2006-07-27 Thread biner . sebastien
> Actually, the code in the book is: > > def f1(): > x = 88 > f2(x) > > def f2(x): > print x > > f1() > > which makes all the difference in the world. Not to mention that this > particular section of the book is giving an example of how to write the > code *without* using nested fun

Re: why is this not working? (nested scope question)

2006-07-26 Thread biner . sebastien
Thanks for the answers. I do understand (and verified) that if I define f2 within f1, it works as expected. But in the "learning pyton 2nd edition" at page 205 it is said that "Programs are much simpler if you do not nest defs within defs" (juste before the code mentioned in my initial message).

why is this not working? (nested scope question)

2006-07-26 Thread biner . sebastien
I have a problem understanding the scope of variable in nested function. I think I got it nailed to the following example copied from Learning Python 2nd edition page 205. Here is the code. def f1() : x=88 f2() def f2() : print 'x=',x f1() that returns an error saying that "NameError:

getting env variable from bourne shell script

2004-12-21 Thread biner
Hello, I have file called PARAMETRES that is used in bourne shell script to define variable. In order to do so I put a ". PARAMETRES" line and the script has acces to all the variable defined in the PARAMETRES file. Now, I would like to be able to get the same thing in python. I googled and p

Re: finding byte order

2004-12-07 Thread biner . sebastien
Scott David Daniels wrote: > biner wrote: > > I am using a program that has to read binary data from files coming > > from different machines. The file are always written with big endian. > > Diez B. Roggisch wrote: > [Scott David Daniels wrote] > >>How abou

finding byte order

2004-12-03 Thread biner
Hello, I am using a program that has to read binary data from files coming from different machines. The file are always written with big endian. I am using the struct module to read the data and it is fine because I can specify in the format if the data are to be read with big or small endian co