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

Steven D'Aprano steve at pearwood.info
Fri Jun 3 22:31:47 EDT 2016


On Sat, 4 Jun 2016 09:06 am, Sayth Renshaw wrote:

> I cant create a list with an append method pf.append(thing) in one go .

Correct. You cannot append to a list until the list exists.

Nor can you uppercase a string until the string exists:

s = "hello world"
s = s.uppercase()


Nor can you add one to a number until the number exists.

x = 0
x += 1


Why should lists be different? How is Python supposed to know pf is a list
with an append method if pf doesn't exist?

# pf = []
pf.append(thing)



-- 
Steven



More information about the Python-list mailing list