Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #95431

Re: Python 3 sort() problem

From Fabien <fabien.maussion@gmail.com>
Newsgroups comp.lang.python
Subject Re: Python 3 sort() problem
Date 2015-08-17 16:12 +0200
Organization Aioe.org NNTP Server
Message-ID <mqsq4l$bq2$1@speranza.aioe.org> (permalink)
References <mailman.58.1439820096.4764.python-list@python.org>

Show all headers | View raw


On 08/17/2015 01:42 PM, Владислав wrote:
> 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?

If sort() returns None, than the following:

x = list(set(x)).sort()

is equivalent to writing:

x = None

So I don't really understand your question, I'm sorry...

Cheers,

Fabien

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Python 3 sort()  problem Fabien <fabien.maussion@gmail.com> - 2015-08-17 16:12 +0200

csiph-web