On 27Jan2018 09:18, Alan Gauld wrote:
On 27/01/18 02:56, boB Stepp wrote:
So my actual question is: For these types of methods/functions, is
Python Both versions 2 and 3) consistent throughout and *always*
returns None?
Mostly, but only for mutable objects.
So the string methods return a new
On 27/01/18 02:56, boB Stepp wrote:
> So my actual question is: For these types of methods/functions, is
> Python Both versions 2 and 3) consistent throughout and *always*
> returns None?
Mostly, but only for mutable objects.
So the string methods return a new string with the modifications
becau
On Fri, Jan 26, 2018 at 08:56:31PM -0600, boB Stepp wrote:
> ... they are not designed to explicitly return something else?
Yes. In the absence of an explicit return, all Python functions will
return None.
> The reason I ask is that I almost fell into the following trap:
>
>
> py3: a_lst = [
... they are not designed to explicitly return something else?
The reason I ask is that I almost fell into the following trap:
py3: a_lst = [0, 1, 2]
py3: b_lst = a_lst.append(3)
py3: a_lst, b_lst
([0, 1, 2, 3], None)
Instead of "None" I was expecting "[0, 1, 2, 3]". Obviously I have a
GCE (Gr