git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

I'm wrong or Will we fix the ducks limp?


On Friday, June 3, 2016 at 3:20:42 PM UTC+1, Sayth Renshaw wrote:

>     pyqFiles = []
>     for filename in sorted(file_list):
>         pyqFiles = pyqFiles.append(pq(filename=my_dir + filename))

This won't end well. The return value from [].append(...) is None.

>>> [].append(0) is None
True

The first time through the loop pqFiles is set to the return value of pqFile.append(...), which is None. 

The second time through, you'll get:
AttributeError: 'NoneType' object has no attribute 'append'


-- 
Jonathan