Re: [Tutor] Assessing local variable outside function

2016-10-28 Thread nils wagenaar
Thank you all! It is clear now:) Verstuurd vanaf mijn iPhone > Op 28 okt. 2016 om 19:31 heeft Ben Finney het > volgende geschreven: > > Alan Gauld via Tutor writes: > >>> On 28/10/16 02:38, nils wagenaar wrote: >>> Could i use a variable defined in a function in another function? > > My ans

Re: [Tutor] Assessing local variable outside function

2016-10-28 Thread Ben Finney
Alan Gauld via Tutor writes: > On 28/10/16 02:38, nils wagenaar wrote: > > Could i use a variable defined in a function in another function? My answer would be: You can't because Python variables don't exist outside their namespace. You can make the object available in various ways, but not the

Re: [Tutor] Assessing local variable outside function

2016-10-28 Thread Peter Otten
nils wagenaar wrote: > Hello, > > > Could i use a variable defined in a function in another function? > > I have now: > > > def DatasetToSubset(file, LatUpbound, LatLowBound, LonUpBound, > LonLowBound): > nc=netCDF4.Dataset(file) > lats=nc.variables['lat'][:]; lons=nc.variables['lon

Re: [Tutor] Assessing local variable outside function

2016-10-28 Thread Alan Gauld via Tutor
On 28/10/16 02:38, nils wagenaar wrote: > Hello, > > > Could i use a variable defined in a function in another function? By returning it to the caller. > def DatasetToSubset(file, LatUpbound, LatLowBound, LonUpBound, LonLowBound): > nc=netCDF4.Dataset(file) > lats=nc.variables['lat'][

[Tutor] Assessing local variable outside function

2016-10-28 Thread nils wagenaar
Hello, Could i use a variable defined in a function in another function? I have now: def DatasetToSubset(file, LatUpbound, LatLowBound, LonUpBound, LonLowBound): nc=netCDF4.Dataset(file) lats=nc.variables['lat'][:]; lons=nc.variables['lon'][:] latselect=np.logical_and(lats > Lat