I want to get a variable which can be used at any method from any class.
I started like this:
class clasificadorDeTweet:
"""Funciones para clasificar tweets"""
def fx():
print trendingTopics
def iniciarConjuntoTrendingTopics():
trendingTopics = ['EPN', 'PRI', 'Peña Nieto', 'México', 'PresidenciaMX', 'Osorio Chong', 'SEDENA', 'PEMEX', 'Reforma Energética', 'Guerra contra el narco', 'Reforma Fiscal', 'Los Pinos'];
return set(trendingTopics)
global trendingTopics
trendingTopics = iniciarConjuntoTrendingTopics()
x=clasificadorDeTweet()
x.fx
But I'm not getting anything printed. What have I got wrong?
x.fxis not a function call; you're not executing yourfxfunctionx.fx().fxasdef fx(self):. Methods require an explicit self parameter to indicate the instance.