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

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

On 03Jun2016 16:09, Sayth Renshaw <flebber.crue at> wrote:
>> (By the way, the "pf = pf.append(thing)" construction is weird.
>> All you need is pf.append(thing).)
>I got the pf = pf.append(thing) from doing pandas because in pandas its not an 
>inplace function.

In Python this doesn't do what you think. The convention with most Python 
methods is that methods which perform an in-place action return None, which 
means the above assignment will unbind "pf", binding it to None instead.

BTW, the short answer to why you can't just say pf.append(thing) and have "pf" 
be a list is that ".append" is not _inherently_ a list method i.e. the langauge 
does not specify that name as special. You can have another type where .append 
does somehing else. Therefore, the deduction that pf is uspposed to be a list 
may not be made.

Cameron Simpson <cs at>