This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Appending non-empty element to a non-empty list yields None
Type: Stage:
Components: Interpreter Core Versions: Python 2.4
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: josiahcarlson, peerjanssen
Priority: high Keywords:

Created on 2004-10-22 08:18 by peerjanssen, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg22815 - (view) Author: Peer Janssen (peerjanssen) Date: 2004-10-22 08:18
Appending a non-empty element to a non-empty list from
a dictionary results in a list of None

Python 2.3.3 (#51, Dec 18 2003, 20:22:39) [MSC v.1200
32 bit (Intel)] on win32 and 
Python 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200
32 bit (Intel)] on win32
yield identical results.


The code (which is supposed to be used in a function
for deleting duplicate files...) contains this line:


which prints the following result:

Warning! ('5e011eda91336d21d3bfc5d5a686bb44\n', '7217')
* None

How can this be?

The tuple is not empty, the entry for it in the
dictionary exists, it is a list of strings, name is not
empty and a string, but appending name to the list from
the dictionary yields "None". Am I missing something,
or is this really a bug?
msg22816 - (view) Author: Peer Janssen (peerjanssen) Date: 2004-10-22 08:58
Logged In: YES 

Ok, I missed something:

>>> x=['a']
>>> print x.append('b')
>>> print x
['a', 'b']

So this is not a bug.
msg22817 - (view) Author: Josiah Carlson (josiahcarlson) * (Python triager) Date: 2004-10-30 15:55
Logged In: YES 

I'll also mention that you are shadowing the global 'len'
and likely global 'md5' with your variable names.

Since you seem to be relatively new to Python, I'll just say
that such things are generally frowned upon in production
Python software, as it tends to confuse others who would
read your code.
Date User Action Args
2022-04-11 14:56:07adminsetgithub: 41060
2004-10-22 08:18:25peerjanssencreate