Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: srinivas devaki Newsgroups: comp.lang.python Subject: Re: How To Create A Endles List Of Lists In Python...??? Date: Sat, 21 Nov 2015 00:05:41 +0530 Lines: 23 Message-ID: References: <564F1AC0.5040106@shopzeus.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de cCNFQCeeGyG/uu7uIoYK1AZ9EsQFQtL3sUvYci3CXblg== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.012 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'cc:addr:python-list': 0.09; 'subject:How': 0.09; 'url:github': 0.09; 'def': 0.13; "'('": 0.16; '...]': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'header:In-Reply-To:1': 0.24; 'error': 0.27; 'fri,': 0.27; 'message-id:@mail.gmail.com': 0.27; "skip:' 10": 0.28; 'code': 0.30; 'skip:_ 10': 0.32; 'subject:List': 0.33; 'received:google.com': 0.35; 'nov': 0.35; 'should': 0.36; 'there': 0.36; 'received:209.85': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:209.85.213': 0.37; 'received:209': 0.38; '20,': 0.66; 'subject:Lists': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=zVYiwSbP/f+VpH7flS6DaRYFsX3QYQcKB8qSexrz3dE=; b=0TnNij6s9Vr/Vwd+IQx2swWjnCUBPcSc0uADWUQpIzyPuHaXkAUFXb9gvjomVJkYOi uoSyYYCDIFjWwrPDbzVq2lX8CacAxIEJXNYqcYxELbzk54ICUrtr+aE0cz92pKGlR3Q7 +HyZXRVVcf76QrNb6NW3jOsZA5wJhghs0DvpswSwvlL7L/Oeq8iMZ5TiNeueUiEiRs7z 71q1QPFQqLRUNWezoVmaGOdhexY4If/eVmHoteV4YylWyrUhb/med1bkXsaRs7ws/FoS mFXbK7TNfDebEgvG+ilJ0ugmBVFmDOh4Sc7nCPUZn+iFvDeBHxQ9xhoq00KEcrN6RkAz rlLA== X-Received: by 10.50.57.84 with SMTP id g20mr1337357igq.44.1448044580498; Fri, 20 Nov 2015 10:36:20 -0800 (PST) In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:99182 On Fri, Nov 20, 2015 at 11:58 PM, srinivas devaki 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.