[Python-bugs-list] [ python-Bugs-638610 ] Instantiation init-less class with param

noreply@sourceforge.net noreply@sourceforge.net
Fri, 15 Nov 2002 02:14:43 -0800


Bugs item #638610, was opened at 2002-11-14 19:53
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=638610&group_id=5470

Category: Type/class unification
Group: Python 2.2.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Shalabh Chaturvedi (shalabh)
Assigned to: Nobody/Anonymous (nobody)
Summary: Instantiation init-less class with param

Initial Comment:
Instantiation new style __init__-less class with
parameters does not raise exception. Old style classes
raise TypeError: this constructor takes no arguments.

Python 2.2.2 (#37, Oct 14 2002, 17:02:34) [MSC 32 bit
(Intel)] on win32
>>> class C:
...     pass
...
>>> c = C('extra', 'params')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: this constructor takes no arguments
>>>
>>> class C(object):
...     pass
...
>>> c = C('whos','eating','my', 'params')
>>> c
<__main__.C object at 0x007A49B8>
>>>

Who?


----------------------------------------------------------------------

>Comment By: Michael Hudson (mwh)
Date: 2002-11-15 10:14

Message:
Logged In: YES 
user_id=6656

This is known behaviour (at least, I knew about it <wink>).

This is why:

>>> object(1,2,3)
<object object at 0x818dfb8>

I seem to recall discussion that this had to be left alone
in 2.2.X but should be fixed in 2.3...

----------------------------------------------------------------------

Comment By: Neal Norwitz (nnorwitz)
Date: 2002-11-14 23:26

Message:
Logged In: YES 
user_id=33168

Confirmed the behaviour in 2.2.2 and 2.3.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=638610&group_id=5470