title: Combine different procedures in python within a class
body: <p>I have two classes in python and Need to recall different procedures within These classes.  </p>
  
  <pre><code>class OpenWeatherMap():
      def __init__(self):
          self.fr='0'
          self.to='0'
          ...
  
       def getWeather(self):
       ...
           return WeatherList
  
  
  class WeatherRecords():
       ...
  
       def allWeatherValues(self):
       ...
           return allSceneList
  </code></pre>
  
  <p>Then, within class WeatherRecords I need to use the allSceneList several times within other different procedures, for example:</p>
  
  <pre><code>def AddWeather(self):
              ...
              if any(weatherConditions in sl for sl in self.allWeatherValues())!=True:
                  print('No such a weather condition in a list!')
                  self.createAttrValue(weatherConditions)
              elif any(weatherConditions in sl for sl in self.allWeatherValues())==True:
                  for j in range(len(self.allWeatherValues())):
                      if weatherConditions==self.allWeatherValues()[j][1]:
              ...
  </code></pre>
  
  <p>I don't want to recalculate this list several times (this is what I do by using self.allWeatherValues()), as it makes no sense. Can I define this as a global variable somehow, but such that my Code doesn't look to bad? Of Course, in the middle of my Code, between procedures, I could have writte something like this: </p>
  
  <p><code>allWeather=allWeatherValues()</code>,</p>
  
  <p>but I've seen that others do not work like this. When I define main() and try to write my statement there, it also appears to be wrong:</p>
  
  <pre><code>def main():
      weather=Weather()
      weatherRecording=WeatherRecords()
      allWeather=weatherRecording.allWeatherValues()
      weatherRecording.AddWeather()
  </code></pre>
  
  <p>Can you please advise something reasonable in my case? </p>
  
  <p>Thank you so much!</p>