list1.append(list2) returns None

Georg Brandl g.brandl-nospam at gmx.net
Thu Dec 21 03:20:58 EST 2006


Pyenos schrieb:
> i rewrote the code following the advices from subdir of the parent thread:
> 
> # well, table is composed of a list of columns.
> # so let's stick them together
> def enlargetable(table,col):
>     table.append(col) # the code won't return sorted lists :-o

Why should it sort the list?

>     return_the_fucking_table_bitch=table # assign it to a new variable to return it
>     return return_the_fucking_table_bitch # :-|

That isn't necessary. A simple "return table" is fine.

> 
> def removecolfromtable(table,col):
>     return table.remove(col)

table.remove() also returns None.

> print enlargetable([[1],[2],[3]],[4])
> 
> # and this code works.

Georg



More information about the Python-list mailing list