Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.017 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'subject:: [': 0.04; '__init__': 0.09; 'subject:method': 0.09; 'cc:addr:python-list': 0.11; 'def': 0.12; '__new__': 0.16; 'foo()': 0.16; 'sender:addr:gmail.com': 0.17; 'wrote:': 0.18; 'subject:] ': 0.20; '>>>': 0.22; 'email addr:gmail.com>': 0.22; 'cc:addr:python.org': 0.22; '>>>': 0.24; 'mon,': 0.24; 'cc:2**0': 0.24; 'class.': 0.26; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'message-id:@mail.gmail.com': 0.30; 'class': 0.32; 'skip:_ 10': 0.34; 'maybe': 0.34; 'problem': 0.35; 'skip:s 30': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'thank': 0.38; 'issue': 0.38; 'skip:- 10': 0.38; 'pm,': 0.38; 'is.': 0.60; "you're": 0.61; '30,': 0.65; 'to:addr:gmail.com': 0.65; 'it!': 0.67; 'actually,': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=kdHmiklK1T+ZNXFympWt6HOrAa62x0GpCW4lcWR5KPQ=; b=kU0N3BR4TXDKvZ14nMkQA+dz8kddlol6Ayj53btCgsa2f24rmzjECNQKbvSqYarZPw P94GDQg1QHfrnMwXODRdbngeMWQpZJJO5PtqGZbKL7zjb3NnAXDxrjASQ0nN3kM/qPkr ZB/2ds529AC7XRnT+IlOtPSrmmfpLBUdPJzBr2pVBGvhrRGeb91Xy/F+Y2kg6yWfEFGe VBDwflimd+VEKS2crUENgiBjSMvukuvY/RFFq1TUSKgc36VEudT206fPAALz25gXIJZM 2fZyggtjGyydqVM/8wHJigX8WMGEEghmFZDi+WMj12hn8wLpMy8MaRbBDXD3RL8uiD8F 2bRg== MIME-Version: 1.0 X-Received: by 10.224.8.9 with SMTP id f9mr59048564qaf.102.1404122488260; Mon, 30 Jun 2014 03:01:28 -0700 (PDT) Sender: kwatch@gmail.com In-Reply-To: References: Date: Mon, 30 Jun 2014 19:01:28 +0900 X-Google-Sender-Auth: l4zuI4hGAXy4egpM9RmRRQMXVSU Subject: Re: [Q] override __init__() method of classes implemented in C From: Makoto Kuwata To: Chris Angelico Content-Type: multipart/alternative; boundary=001a11c24828224d5404fd0abed8 Cc: "python-list@python.org" 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: 51 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1404122497 news.xs4all.nl 2956 [2001:888:2000:d::a6]:34072 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:73742 --001a11c24828224d5404fd0abed8 Content-Type: text/plain; charset=UTF-8 On Mon, Jun 30, 2014 at 4:52 PM, Chris Angelico wrote: > > Actually, __init__ isn't the problem here, __new__ is. > > class Foo(datetime): > def __new__(self): > return super().__new__(self,2014,1,1) > > >>> Foo() > Foo(2014, 1, 1, 0, 0) > > Maybe that helps, maybe it doesn't, but the issue you're seeing is > specific to that class. > Got it! Thank you! -- regards, makoto kuwata --001a11c24828224d5404fd0abed8 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

= On Mon, Jun 30, 2014 at 4:52 PM, Chris Angelico <rosuav@gmail.com> wrote:

Actually, __init__ isn't the problem here, __new__ is.

class Foo(datetime):
=C2=A0 =C2=A0 def __new__(self):
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return super().__new__(self,2014,1,1)

>>> Foo()
Foo(2014, 1, 1, 0, 0)

Maybe that helps, maybe it doesn't, but the issue you're seeing is<= br> specific to that class.

Got it! Thank y= ou!

--
regards,
makoto kuwata<= /div>
--001a11c24828224d5404fd0abed8--