Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:not': 0.03; 'heavily': 0.04; 'receives': 0.04; 'subject:Python': 0.06; 'problem:': 0.07; '__init__': 0.09; 'arguments': 0.09; 'cc:addr :python-list': 0.11; 'python': 0.11; 'accepting': 0.14; 'anyway': 0.14; '2.7.3?': 0.16; 'args,': 0.16; 'article:': 0.16; 'cc:name:python list': 0.16; 'conclusion:': 0.16; 'positional': 0.16; 'subject: \n ': 0.16; 'those,': 0.16; 'workaround:': 0.16; 'essential': 0.16; 'wrote:': 0.18; 'producing': 0.19; 'seems': 0.21; '(the': 0.22; 'cc:addr:python.org': 0.22; 'subject:problem': 0.24; 'cc:2**0': 0.24; 'pass': 0.26; 'header:In-Reply-To:1': 0.27; 'generally': 0.29; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'keywords,': 0.31; 'relies': 0.31; 'workaround': 0.31; 'class': 0.32; 'problem': 0.35; 'subject:with': 0.35; 'advice': 0.35; 'received:209.85': 0.35; 'received:209.85.220': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'keyword': 0.36; 'received:209': 0.37; 'implement': 0.38; 'that,': 0.38; 'skip:u 10': 0.60; 'solve': 0.60; 'first': 0.61; 'to:addr:gmail.com': 0.65; 'results': 0.69; 'oscar': 0.84; 'subject: *': 0.84; 'subject:skip:o 10': 0.84; 'dirty': 0.93; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=MG3mY4zLV4+3NoyBGMMAdA1Sw3D/WxVpALk/T47mj3E=; b=tYXSiKdZvXDIU6LfMEjtUIw6lgWdkxwZ0I4wiEGl21dT6PqTjdUB9Orom8z9QRR1q2 pK4Ok2Vl2yMIDyfPZYwfeHwyaXM8JOmqGnxzl69G8M1kJszz/tUvZynC10rmH3dTaYzA 8JfUpQyercpyYpdSGPXsUwwHxfAUcvYGkvvZGhe47p0Xx/fQVgvOfkwqLSncfxKz8PWf 0ROCTdbjPgWx6c3vq79lZvYMENSoi1cijziSqzdyauy0c1DYWyhf1Lx6CDkKc+W5HyQy AHizryCH6WisIn4bft1Dv3Tl3yqKlRf1yJ3o17YxqwCtlcTtoKoy4uWBmBcuTapjEojf tQxg== X-Received: by 10.58.161.6 with SMTP id xo6mr24221786veb.50.1368620189451; Wed, 15 May 2013 05:16:29 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: From: Oscar Benjamin Date: Wed, 15 May 2013 13:16:09 +0100 Subject: Re: Python 2.7.x - problem with obejct.__init__() not accepting *args and **kwargs To: wzab Content-Type: text/plain; charset=ISO-8859-1 Cc: Python List X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 33 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1368620192 news.xs4all.nl 15921 [2001:888:2000:d::a6]:43310 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:45335 On 15 May 2013 12:18, wzab wrote: > I had to implement in Python 2.7.x a system which heavily relies on > multiple inheritance. > Working on that, I have came to very simplistic code which isolates > the problem: > (The essential thing is that each base class receives all arguments > and uses only those, > which it understands). > [snip] > > I have found a workaround: > > # Class my_object added only as workaround for a problem with > # object.__init__() not accepting any arguments. [snip] > > The above works correctly, producing the same results as the first > code in Python 2.5.2, > but anyway it seems to me just a dirty trick... > What is the proper way to solve that problem in Python 2.7.3? I don't generally use super() but I did see some advice about it in this article: https://fuhm.net/super-harmful/ >From the conclusion: "Never use positional arguments in __init__ or __new__. Always use keyword args, and always call them as keywords, and always pass all keywords on to super." Oscar