New submission from Kevin J. Woolley <[EMAIL PROTECTED]>:

Doing the following (more info than necessary in case I'm doing
something weird):

def odd(n):
    return n % 2

x = (1, 2, 3, 4, 5)
y = filter(odd, x)
list(y)
list(y)

Will correctly build a list from y and return [1, 3, 5] on the first
call to list(), but will return an empty list thereafter.  y still
identifies itself as a filter object, but you either can't coerce it to
anything else or the value of the filter object is reset (I don't know
how to tell the difference yet).

The other container constructors (set, tuple, etc.) seem to have the
same behaviour.

----------
components: Library (Lib)
messages: 76975
nosy: kjwcode
severity: normal
status: open
title: container constructors destroy argument
type: behavior
versions: Python 3.0

_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue4543>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to