Appending to []
a = [].append('x').append('y').append('z'). would be possible with a containing the resulting list ['. x', 'y', 'z']. That is the way I expect any append to behave.
a = [].append('x').append('y').append('z'). would be possible with a containing the resulting list ['. x', 'y', 'z']. That is the way I expect any append to behave.
Also, as a quick note: Python list append is not functional: it mutates rather than returns a useful return value. You may need to revisit the parts in the code where it assumes a different behavior from functional append.
This is syntactically wrong, so is there a function which appends a > value to a list and > returns the new value, so that I could write something like this: > > f(list(a).functional_append(4)). Sure there is, just not as a list method.
Kent Johnson wrote: > Note that Python 2.4 has set built-in with the name 'set'. To be > compatible with both you could write > try: > set > except NameError: > from sets import Set as set. Clarification: you don't _have_ to do this to be compatible with 2.4.