Changing return value for mutating list

Category: Python - Education

Mutating list methods such as 'append' or 'extend' return None instead of the (mutated) list itself. Sometimes, this is not the desired behaviour. To have a reference to the (mutated) list returned is usefull, if one wants to chain commands such as mylistinstance.append(7).sort(). Date: 12 March, 2012


Mutating List Methods - List Management - Value Return - Mutating - List - Methods

Homepage: http://code.activestate.com/

Developer: code.activestate.com

License: Freeware

Operating System: All

Add a Comment

all are required fields

     
What do you think of this resource?

Select Your Rate:

Votes:0

 

Related Scripts Download

Mutating list methods such as 'append' or 'extend' return None instead of the (mutated) list itself.

developer Developer: code.activestate.com
license License: Artistic License, GNU General Public License (GPL)
operating systems Operating System: Windows, Linux, Mac OS, BSD, Solaris


This script shows you a list of options based on what you type into a text input.

developer Developer: dhtmlgoodies.com
license License: Freeware
operating systems Operating System: All


Javascript can remember a list of several items you enter.

developer Developer: javascriptsource.com
license License: Freeware
operating systems Operating System: All


This script returns a sorted list of the most common to least common elements and their counts.

developer Developer: code.activestate.com
license License: Freeware
operating systems Operating System: All


This script implements an observer pattern for dictionaries and lists.

developer Developer: code.activestate.com
license License: Freeware
operating systems Operating System: All


This is an implementation of the binary search algorithm in (almost) one line.

developer Developer: code.activestate.com
license License: Freeware
operating systems Operating System: All


Bag collection class script implements Smalltalk's bag class.

developer Developer: code.activestate.com
license License: Freeware
operating systems Operating System: All


The script demonstrates the use of SETs in Python.

developer Developer: code.activestate.com
license License: Freeware
operating systems Operating System: All


Singleton as a metaclass script shows you how to use metaclasses to hide access to class constructor.

developer Developer: code.activestate.com
license License: Freeware
operating systems Operating System: All