[ python-Bugs-1052036 ] Appending non-empty element to a non-empty list yields None

SourceForge.net noreply at sourceforge.net
Fri Oct 22 10:58:33 CEST 2004


Bugs item #1052036, was opened at 2004-10-22 08:18
Message generated for change (Comment added) made by peerjanssen
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1052036&group_id=5470

Category: Python Interpreter Core
Group: Python 2.4
>Status: Closed
>Resolution: Invalid
Priority: 7
Submitted By: Peer Janssen (peerjanssen)
Assigned to: Nobody/Anonymous (nobody)
Summary: Appending non-empty element to a non-empty list yields None

Initial Comment:
Appending a non-empty element to a non-empty list from
a dictionary results in a list of None


Scope:
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.

Description:

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

print
"Warning!",(md5,len),'*',MainDic[(md5,len)],'*',name,'*',MainDic[(md5,len)].append(name)

which prints the following result:

Warning! ('5e011eda91336d21d3bfc5d5a686bb44\n', '7217')
*
['D:\_Arbeit\_In\_Roaming\_Telework\www.ivc.ca\part9.html',
'D:\_Arbeit\_I
n\_Roaming\_Telework\www.ivc.ca\part9.html.primary']
*
D:\_Arbeit\_In\_Roaming\_Telework\www.ivc.ca\part9.html.primary
* 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?


----------------------------------------------------------------------

>Comment By: Peer Janssen (peerjanssen)
Date: 2004-10-22 08:58

Message:
Logged In: YES 
user_id=896722

Ok, I missed something:

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

So this is not a bug.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1052036&group_id=5470


More information about the Python-bugs-list mailing list