Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #73742

Re: [Q] override __init__() method of classes implemented in C

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 <kwatch@gmail.com>
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&gt;': 0.22; 'cc:addr:python.org': 0.22; '&gt;&gt;&gt;': 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 <CAPTjJmptszMxLgaiBcrtzeu=LvsiRKkt3rDnM4r6UM=xLXuZ=Q@mail.gmail.com>
References <CAFTm5RvAmdDQSe03mekY-26Zm+Eu-qWwN5W=L1NUre9KPRg77w@mail.gmail.com> <CAPTjJmptszMxLgaiBcrtzeu=LvsiRKkt3rDnM4r6UM=xLXuZ=Q@mail.gmail.com>
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 <kwa@kuwata-lab.com>
To Chris Angelico <rosuav@gmail.com>
Content-Type multipart/alternative; boundary=001a11c24828224d5404fd0abed8
Cc "python-list@python.org" <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 <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.11337.1404122497.18130.python-list@python.org> (permalink)
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

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

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):
>     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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: [Q] override __init__() method of classes implemented in C Makoto Kuwata <kwa@kuwata-lab.com> - 2014-06-30 19:01 +0900

csiph-web