In Python, when a function mutates an object it generally returns None
.
Otherwise it returns the new object.
remove
mutates the original object, which is why when you do aList.remove(1)
and then print the list, you will see that the list is different.
More Related Contents:
- The letter ‘n’ is invalid syntax in Python? [closed]
- Is there a way to declare all the values in the list as a list individually in python [closed]
- What does ** (double star/asterisk) and * (star/asterisk) do for parameters?
- What does the star and doublestar operator mean in a function call?
- What is the difference between ‘/’ and ‘//’ when used for division?
- What is the result of % in Python?
- Accessing dict keys like an attribute?
- Why does adding a trailing comma after a variable name make it a tuple?
- “x not in y” or “not x in y”
- What does “while True” mean in Python?
- Python “raise from” usage
- What does ‘wb’ mean in this code, using Python?
- Why isn’t assigning to an empty list (e.g. [] = “”) an error?
- What does “ mean in Python?
- Is it possible to get a list of keywords in Python?
- How to normalize a 2-dimensional numpy array in python less verbose?
- Reversing a list using slice notation
- Why does python use two underscores for certain things?
- What is the purpose of the colon before a block in Python?
- Getting a default value on index out of range in Python [duplicate]
- Python – is there a “don’t care” symbol for tuple assignments?
- Python: Make class iterable
- Python: format string with custom delimiters [duplicate]
- How to include a quote in a raw Python string
- How to include a double-quote and/or single-quote character in a raw Python string literal?
- Get the first element of each tuple in a list in Python [duplicate]
- Python: SyntaxError: keyword can’t be an expression
- str.format() raises KeyError
- Square braces not required in list comprehensions when used in a function
- How can I diagnose common errors in JSON data?