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

Makoto Kuwata kwa at kuwata-lab.com
Mon Jun 30 06:01:28 EDT 2014


On Mon, Jun 30, 2014 at 4:52 PM, Chris Angelico <rosuav at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20140630/deb6705a/attachment.html>


More information about the Python-list mailing list