Ah, I got it, I think:
def __init__(self, subject=None, text=None, attachments=set()):
This usually does not what you want in Python. You should do "attachments=None" and explicitly check for None in the function body:
--- /home/ubuntu-archive/apport-retracer-i386/apport/launchpadbugs/commentsbase.py.orig 2008-02-18 12:26:38.000000000 +0000 +++ /home/ubuntu-archive/apport-retracer-i386/apport/launchpadbugs/commentsbase.py 2008-02-18 12:27:13.000000000 +0000 @@ -4,10 +4,11 @@
class LPComment(object): - def __init__(self, subject=None, text=None, attachments=set()): + def __init__(self, subject=None, text=None, attachments=None): self.subject = subject self.text = text - self.__attachments = set() + if attachments is None: + attachments = set() if isinstance(attachments, LPAttachment): self.__attachments = set([attachments]) else:
(This removes the redundant self.__attachments = set(), too, since it's assigned in both the then and else clause further down).
Ah, I got it, I think:
def __init__(self, subject=None, text=None, attachments=set()):
This usually does not what you want in Python. You should do "attachments=None" and explicitly check for None in the function body:
--- /home/ubuntu- archive/ apport- retracer- i386/apport/ launchpadbugs/ commentsbase. py.orig 2008-02-18 12:26:38.000000000 +0000 archive/ apport- retracer- i386/apport/ launchpadbugs/ commentsbase. py 2008-02-18 12:27:13.000000000 +0000
+++ /home/ubuntu-
@@ -4,10 +4,11 @@
class LPComment(object):
self. subject = subject attachments, LPAttachment):
self. __attachments = set([attachments])
- def __init__(self, subject=None, text=None, attachments=set()):
+ def __init__(self, subject=None, text=None, attachments=None):
self.text = text
- self.__attachments = set()
+ if attachments is None:
+ attachments = set()
if isinstance(
else:
(This removes the redundant self.__attachments = set(), too, since it's assigned in both the then and else clause further down).