On 04/24/12 15:43, Drew Fisher wrote:
Passing an empty list (or any mutable object) in as a default arg is
sort of a no-no. The default value for reject_list is allocated when the
class is created, not when it's called.
I think it would be better to leave it as None, but then in __init__,
check for None:
def __init__(self, .... reject_list=None, .....):
<....>
if reject_list is None:
reject_list = list()
This way we're protected.
I know the odds of us hitting something here is low, but I'd be safe
than sorry. If you do decide to take up this change, no follow-up webrev
is necessary.
If you just want a generic iterable, you can use 'frozenset()' instead.
If you're not indexing into the iterable by slices, that's preferable to
a list() anyway as it will cause an error if it gets changed.
-Shawn
_______________________________________________
caiman-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/caiman-discuss