Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #95433
| Path | csiph.com!goblin1!goblin.stu.neva.ru!uio.no!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.05; 'from:addr:yahoo.co.uk': 0.05; 'none,': 0.05; '[1,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'first:': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'sort()': 0.16; 'wrote:': 0.16; 'language': 0.19; 'assign': 0.22; 'converted': 0.22; 'lawrence': 0.22; 'subject:problem': 0.22; 'header:In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'fine': 0.28; 'guess': 0.31; 'language.': 0.32; 'returned': 0.32; 'skip:\xd0 10': 0.33; 'that,': 0.34; 'but': 0.36; 'created': 0.36; 'to:addr:python- list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'list.': 0.37; 'why': 0.39; 'to:addr:python.org': 0.40; 'mark': 0.40; 'our': 0.64; '8bit%:100': 0.70; 'received:89': 0.80; 'pythonistas,': 0.84 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
| Subject | Re: Python 3 sort() problem |
| Date | Mon, 17 Aug 2015 15:18:45 +0100 |
| References | <006601d0d8e1$c17c1480$44743d80$@inbox.ru> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 8bit |
| X-Gmane-NNTP-Posting-Host | host-89-240-164-46.as13285.net |
| User-Agent | Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 |
| In-Reply-To | <006601d0d8e1$c17c1480$44743d80$@inbox.ru> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.20+ |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.60.1439821153.4764.python-list@python.org> (permalink) |
| Lines | 29 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1439821153 news.xs4all.nl 26616 [2001:888:2000:d::a6]:58757 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:95433 |
Show key headers only | View raw
On 17/08/2015 12:42, Владислав wrote: > # first: works fine > > x = [1, 2, 4, 2, 1, 3] > x = list(set(x)) > x.sort() > print(x) /# output: 1, 2, 3, 4 > > /# second: why x became None ?? > > x = [1, 2, 4, 2, 1, 3] > x = list(set(x)).sort() > print(x) /# output: None/ > > I know that sort() returns None, but I guess that it would be returned x > that was sorted. Why so?/ A set is created from x. This is converted to a list. You call sort() and assign the return value from that, None, to x. You will see exactly the same thing above if you do:- x = x.sort() -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Python 3 sort() problem Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-08-17 15:18 +0100
csiph-web