On 03Jun2016 16:09, Sayth Renshaw <flebber.c...@gmail.com> 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.

Cheers,
Cameron Simpson <c...@zip.com.au>
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to