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


Groups > comp.lang.python > #32963

Re: int.__init__ incompatible in Python 3.3

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!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
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:Python': 0.05; 'bug.': 0.07; 'parameter': 0.07; 'works.': 0.07; '__init__': 0.09; 'bug': 0.10; 'def': 0.10; '2.7': 0.13; '3.2,': 0.16; '3.3,': 0.16; 'backward': 0.16; 'devs': 0.16; 'eckhardt': 0.16; 'feature?': 0.16; 'other:': 0.16; 'preparing': 0.16; 'stumbled': 0.16; 'subject:3.3': 0.16; 'wrote:': 0.17; 'issue,': 0.17; 'thu,': 0.17; 'sort': 0.21; '3.2': 0.22; 'bug?': 0.22; 'object.': 0.22; 'header :In-Reply-To:1': 0.25; 'am,': 0.27; 'wonder': 0.27; 'message- id:@mail.gmail.com': 0.27; 'document,': 0.29; 'initialized': 0.29; 'though.': 0.29; 'skip:_ 10': 0.29; 'class': 0.29; 'call.': 0.30; 'received:209.85.215.46': 0.30; 'sense': 0.31; 'code': 0.31; 'could': 0.32; 'int': 0.33; 'to:addr:python-list': 0.33; 'another': 0.33; 'received:google.com': 0.34; 'nov': 0.35; 'open': 0.35; 'similar': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'should': 0.36; 'drop': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'nothing': 0.38; 'gives': 0.39; 'to:addr:python.org': 0.39; 'takes': 0.39; 'header:Received:5': 0.40; 'between': 0.63; 'behavior': 0.64; 'hand': 0.82; 'to:name:python': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=vB7yVCqUTEvYglzNCTgJuRu6Imlltvm2HjIo/DIA6t8=; b=TdM7zxNdxTQhuWd+W/+9zwB5Bdibl28mk9Go6fBdLmtKns8s/4r7vmkSyL5QypAxkj VTMfGHh6LxC2H3KkoZCj0284PgfyMZZf7GW6q+Pos49vBaJy/PrBPa8dyv7+QN+d9pnW E+igCGb7/IyfQRni9LtiDRaG0eDfVgxnvLvjW0nNgJFJeqt2ucyeIijLs7VhJNUSUKm+ KZTtCyax7WEsIACmcwp2Ow/C8z1RivxZ5Ybo9Pk9Uv9t2BVPOt1lTJ0q8Uq3X4ZVgRsJ NM2H9ddYLf9e5i30gfaJhBgCiarzEeGpnp+4+q/Ytx33alSj2/mCG4WKo51ls9/Ve0Nr bzeA==
MIME-Version 1.0
In-Reply-To <481tm9-k6i.ln1@satorlaser.homedns.org>
References <481tm9-k6i.ln1@satorlaser.homedns.org>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Thu, 8 Nov 2012 10:13:09 -0700
Subject Re: int.__init__ incompatible in Python 3.3
To Python <python-list@python.org>
Content-Type text/plain; charset=ISO-8859-1
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 <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3453.1352394822.27098.python-list@python.org> (permalink)
Lines 25
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1352394822 news.xs4all.nl 6919 [2001:888:2000:d::a6]:32990
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:32963

Show key headers only | View raw


On Thu, Nov 8, 2012 at 8:55 AM, Ulrich Eckhardt
<ulrich.eckhardt@dominolaser.com> wrote:
> Hi!
>
> Preparing for an upgrade from 2.7 to 3, I stumbled across an incompatibility
> between 2.7 and 3.2 on one hand and 3.3 on the other:
>
> class X(int):
>     def __init__(self, value):
>         super(X, self).__init__(value)
> X(42)
>
> On 2.7 and 3.2, the above code works. On 3.3, it gives me a "TypeError:
> object.__init__() takes no parameters". To some extent, this makes sense to
> me, because the int subobject is not initialized in __init__ but in __new__.
> As a workaround, I can simple drop the parameter from the call. However,
> breaking backward compatibility is another issue, so I wonder if that should
> be considered as a bug.
>
> Bug? Feature? Other suggestions?

A similar change was made to object.__init__ in 2.6, so this could
just be bringing the behavior of int into line with object.  There's
nothing about it in the whatsnew document, though.  I say open a bug
report and let the devs sort it out.

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


Thread

int.__init__ incompatible in Python 3.3 Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-11-08 16:55 +0100
  Re: int.__init__ incompatible in Python 3.3 Ian Kelly <ian.g.kelly@gmail.com> - 2012-11-08 10:13 -0700
  Re: int.__init__ incompatible in Python 3.3 Terry Reedy <tjreedy@udel.edu> - 2012-11-08 15:29 -0500
    Re: int.__init__ incompatible in Python 3.3 Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-11-09 08:56 +0100
      Re: int.__init__ incompatible in Python 3.3 Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-09 11:37 +0000
        Re: int.__init__ incompatible in Python 3.3 Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-11-09 13:52 +0100
        Re: int.__init__ incompatible in Python 3.3 Ian Kelly <ian.g.kelly@gmail.com> - 2012-11-09 09:30 -0700
        Re: int.__init__ incompatible in Python 3.3 Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-11-12 14:48 +0100

csiph-web