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

References <CAFTm5RvAmdDQSe03mekY-26Zm+Eu-qWwN5W=L1NUre9KPRg77w@mail.gmail.com> <CAPTjJmptszMxLgaiBcrtzeu=LvsiRKkt3rDnM4r6UM=xLXuZ=Q@mail.gmail.com>
Date 2014-06-30 19:01 +0900
Subject Re: [Q] override __init__() method of classes implemented in C
From Makoto Kuwata <kwa@kuwata-lab.com>
Newsgroups comp.lang.python
Message-ID <mailman.11337.1404122497.18130.python-list@python.org> (permalink)

Show all headers | 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