Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'output': 0.05; 'none,': 0.07; 'subject: [': 0.09; 'subject:None': 0.09; 'cc:addr:python- list': 0.11; 'python': 0.11; '[none,': 0.16; 'effect.': 0.16; 'evaluating': 0.16; 'from:addr:pobox.com': 0.16; 'from:addr:skip': 0.16; 'none.': 0.16; 'none]': 0.16; 'sender:addr:gmail.com': 0.17; 'wrote:': 0.18; 'thu,': 0.19; 'cc:addr:python.org': 0.22; 'print': 0.22; 'skip': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; '>>>>': 0.31; 'values.': 0.31; 'url:python': 0.33; 'actual': 0.34; 'subject:the': 0.34; 'received:google.com': 0.35; 'there': 0.35; 'url:listinfo': 0.36; 'url:org': 0.36; 'list': 0.37; 'subject:]': 0.38; 'url:mail': 0.40; 'length': 0.61; 'to:addr:gmail.com': 0.65; 'side': 0.67; 'power': 0.76; 'subject:have': 0.80 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=/qUUz4WJBeDJHw71KKR+liWD/JuAscjCwqNoaPzvRM4=; b=jnBeEDTigzBg1h8+t5KdZYt9m4EjI/CpunYGyxPCr3MyPoc4NBLq3YaFdxIBYrvfYi AiL3t7E7clTw1TCQ5lgKWIpisNFEEwGkhsBe3ein24S9aGSUc3nysuEsE18XsZRQAVv5 8bW/8V+8nTyWEARJx+JsK9Wduh/UFgxAI0veM6Ix2mrxqGw+UFXdYzV7FfsWxSGGAnco bIQ795LSMIrQwH3yhWKns42UlDgrHuCoJ7pnw5I7PPXN5NHy69uRV2AJ2hk5W9lUfukR ps3BCICPCX6eBb9qoi+FDyCxxhN+DDKbnPgOrwrADJY2muQjgCg46LSaRADOsp8vhzcU UUzw== MIME-Version: 1.0 X-Received: by 10.50.60.103 with SMTP id g7mr11061783igr.20.1397139146159; Thu, 10 Apr 2014 07:12:26 -0700 (PDT) Sender: skip.montanaro@gmail.com In-Reply-To: References: Date: Thu, 10 Apr 2014 09:12:26 -0500 X-Google-Sender-Auth: 8WZgYzvPlhwZmI8Q-db5rrurqXo Subject: Re: why i have the output of [None, None, None] From: Skip Montanaro To: length power Content-Type: text/plain; charset=UTF-8 Cc: Python X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 22 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1397139154 news.xs4all.nl 2900 [2001:888:2000:d::a6]:38479 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:70038 The print function in Python 3 returns None. The "ok" output is a side effect. The actual value of evaluating that list comprehension is a list of three None values. Skip On Thu, Apr 10, 2014 at 8:54 AM, length power wrote: >>>> x=['','x1','x2','x3',' '] >>>> x > ['', 'x1', 'x2', 'x3', ' '] >>>> [print("ok") for it in x if it.strip() !=""] > ok > ok > ok > [None, None, None] > > i understand there are three 'ok' in the output,but why i have the output of > [None, None, None] > > -- > https://mail.python.org/mailman/listinfo/python-list >