How To Create A Endles List Of Lists In Python...???

srinivas devaki mr.eightnoteight at gmail.com
Fri Nov 20 13:35:41 EST 2015


On Fri, Nov 20, 2015 at 11:58 PM, srinivas devaki
<mr.eightnoteight at gmail.com> wrote:
>     def __str__(self):
>         if len(self.list) == 0:
>             return '(' + str(self.data) +  ')[...]'
>         return ''.join(['(', str(self.data), ')['] + map(str, self.list) + [', ...]'])
> ...
> Gist: https://gist.github.com/c0c2ee1e7c6535ef8c3d

uhh, there is an error in representing it, the code should be

def __str__(self):
    if len(self.list) == 0:
        return '(' + str(self.data) +  ')[...]'
    return ''.join(['(', str(self.data), ')[', ', '.join(map(str,
self.list)), ', ...]'])

Output:
(None)[...]
(None)[(None)[...], (None)[...], (None)[...], (20)[...], ...]


ps: code is updated in gist.



More information about the Python-list mailing list