Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python list append gives a error: AttributeError: 'function' object has no attribute 'append'

I have list = [] and I am adding an element to it using self.list.append('test') and I get this error - AttributeError: 'function' object has no attribute 'append'

The other list that I have defined append just fine, any ideas?

like image 252
peztherez Avatar asked Feb 16 '23 08:02

peztherez


1 Answers

It seems you have a function in your code that is shadowing Python's built-in function named list.

like image 130
Saullo G. P. Castro Avatar answered Apr 27 '23 08:04

Saullo G. P. Castro