From 93315583406015da30e81261e092c029f1b9350c Mon Sep 17 00:00:00 2001 From: Isaac Smith Date: Sat, 14 May 2016 19:13:58 -0400 Subject: [PATCH] Align with original methods Rewrote the results method a bit so it returned something similar to the original result, which will make the transition easier. --- wolframalpha/__init__.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/wolframalpha/__init__.py b/wolframalpha/__init__.py index 60c22b9..0a5e0b7 100644 --- a/wolframalpha/__init__.py +++ b/wolframalpha/__init__.py @@ -71,14 +71,6 @@ class Result(object): template = 'Error {code}: {msg}' raise Exception(template.format(code=code, msg=msg)) - def _flatten(self, lists): - ''' - src: http://stackoverflow.com/a/952952/4241708 - usr: intuited - ''' - from itertools import chain - return list(chain.from_iterable(lists)) - def __iter__(self): return iter(self.info) @@ -88,7 +80,7 @@ class Result(object): @property def results(self): ''' Get the response to a simple, discrete query. ''' - return self._flatten([pod.details for pod in self.pods if pod.primary or pod.title=='Result']) + return [pod for pod in self.pods if pod.primary or pod.title=='Result'] @property def details(self):