Re: NoneType List

2022-12-31 Thread dn
On 31/12/2022 18.45, Goran Ikac wrote: Happy New Year, everybody! I'm new in the Python List, new in Python world, and new in coding. A few days (weeks?) ago, I faced a problem trying to write a program for an exercise. I asked for help and nobody answered. In the meantime, I found a part of the

Re: NoneType List

2022-12-31 Thread Alan Gauld
On 31/12/2022 05:45, Goran Ikac wrote: > b = a.append(3) > I mean: why b = a.append(something) is the None type, and how to make a new > list that contains all the items from a and some new items? append() like many other collection methods in Python works in place and returns None. But the act

Re: NoneType List

2022-12-31 Thread Chris Roy-Smith
On 31/12/22 16:45, Goran Ikac wrote: Happy New Year, everybody! I'm new in the Python List, new in Python world, and new in coding. A few days (weeks?) ago, I faced a problem trying to write a program for an exercise. I asked for help and nobody answered. In the meantime, I found a part of the so

Re: NoneType List

2022-12-31 Thread Weatherby,Gerard
Just use the addition operator: a = [1,2] a = a + [3,4] a is now [1, 2, 3, 4] From: Python-list on behalf of Goran Ikac Date: Saturday, December 31, 2022 at 1:53 AM To: python-list@python.org Subject: NoneType List *** Attention: This is an external email. Use caution responding, opening a

NoneType List

2022-12-31 Thread Thomas Passin
Happy New Year, everybody! I'm new in the Python List, new in Python world, and new in coding. A few days (weeks?) ago, I faced a problem trying to write a program for an exercise. I asked for help and nobody answered. In the meantime, I found a part of the solution, but a part still remains a mys

Re: set.add() doesn't replace equal element

2022-12-31 Thread Ian Pilcher
On 12/30/22 17:00, Paul Bryan wrote: It seems to me like you have to ideas of what "equal" means. You want to update a "non-equal/equal" value in the set (because of a different time stamp). If you truly considered them equal, the time stamp would be irrelevant and updating the value in the set

Re: NoneType List

2022-12-31 Thread Thomas Passin
Oops, my reply got lost somehow. Here it is: Everyone's answer to date has been too complicated. What is going on is that list.append() changes the list in place. It returns nothing. If you want to append an item and then assign the result to a new list, you have to do just that: l1.appe

Re: NoneType List

2022-12-31 Thread MRAB
On 2022-12-31 05:45, Goran Ikac wrote: Happy New Year, everybody! I'm new in the Python List, new in Python world, and new in coding. A few days (weeks?) ago, I faced a problem trying to write a program for an exercise. I asked for help and nobody answered. In the meantime, I found a part of the

Re: NoneType List

2022-12-31 Thread dn
On 31/12/2022 18.45, Goran Ikac wrote: ... A few days (weeks?) ago, I faced a problem trying to write a program for an exercise. I asked for help and nobody answered. Looking back over the last six months of List-Archives, your name does not appear against a single post. This may explain why "

RE: NoneType List

2022-12-31 Thread avi.e.gross
It depends on what people consider too complicated. I find it a tad complicated when someone posts using two different ID, and then wonders ... The question related to taking a list and extending it and using the result in an assignment statement. There were several inter-related questions peopl

Re: NoneType List

2022-12-31 Thread Thomas Passin
On 12/31/2022 3:58 PM, dn wrote: On 31/12/2022 18.45, Goran Ikac wrote: ... A few days (weeks?) ago, I faced a problem trying to write a program for an exercise. I asked for help and nobody answered. Looking back over the last six months of List-Archives, your name does not appear against a

Re: NoneType List

2022-12-31 Thread Greg Ewing
On 1/01/23 11:36 am, avi.e.gr...@gmail.com wrote: And, of course, we had the philosophical question of why the feature was designed to not return anything ... rather than return the changed object. My understanding is that Guido designed it that way to keep a clear separation between mutating a

RE: NoneType List

2022-12-31 Thread avi.e.gross
Agreed, there are lots of pro/con arguments and the feature is what it is historically and not trivial to change. Inline changes to an object make sense to just be done "silently" and if there are errors, they propagate the usual way. As Guido was a major influence at that time, one view was see

Re: NoneType List

2022-12-31 Thread Chris Angelico
On Sun, 1 Jan 2023 at 14:19, wrote: > Had a language like that been created today, I wonder if some designs might > have looked a bit different so that some functions could be called with > optional arguments that specified what the user wanted returned. Frankly, I doubt it. While you can argue "

RE: NoneType List

2022-12-31 Thread avi.e.gross
Chris, There is much to say about consistent behavior as compared to flexibility and convenience. I have seen other languages provide functions for example, where the result can vary and often cause confusion. R had a function that would sometimes notice the result could be simplified and return

Re: NoneType List

2022-12-31 Thread Chris Angelico
On Sun, 1 Jan 2023 at 15:16, wrote: > > Chris, > > There is much to say about consistent behavior as compared to flexibility > and convenience. > > I have seen other languages provide functions for example, where the result > can vary and often cause confusion. R had a function that would sometim