This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Int Type Documentation incomplete
Type: Stage:
Components: None Versions:
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: mwh Nosy List: cjwhrh, mwh
Priority: normal Keywords:

Created on 2004-08-06 16:01 by cjwhrh, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (5)
msg21974 - (view) Author: Colin J. Williams (cjwhrh) Date: 2004-08-06 16:01
__new__ and __newargs__ don't appear to be documented

c.mro() seems to show a circular definition.

Please see the examples below:
>>> c
<type 'int'>
>>> c.mro()
[<type 'int'>, <type 'object'>]
>>> c.__getnewargs__()
<method '__getnewargs__' of 'int' objects>
>>> c.__getnewargs__(21)
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
TypeError: descriptor '__getnewargs__' of 'int' object
needs an argument
>>> c.__getnewargs__(21)
(21,)
>>> c= 1+1j
>>> c
(1+1j)
>>> c.__getnewargs__(21)
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
TypeError: __getnewargs__() takes no arguments (1 given)
>>> c.__getnewargs__()
((1+1j),)
>>> c.__new__
<built-in method __new__ of type object at 0x1E0B1B40>
>>> c.__new__(ComplexType)
0j
>>> 

Colin W.
msg21975 - (view) Author: Michael Hudson (mwh) (Python committer) Date: 2004-08-07 15:42
Logged In: YES 
user_id=6656

It's hard to make out which specific bug you are reporting, or even 
if you are reporting a specific bug.  Can you please clarify?
msg21976 - (view) Author: Colin J. Williams (cjwhrh) Date: 2004-08-07 18:14
Logged In: YES 
user_id=285587

The first two seem to be missing from the Reference Doc.

This third is more a matter of puzzlement.

c is of TypeInt
c.mro() returns <type 'int'> as the first item in its list.
msg21977 - (view) Author: Michael Hudson (mwh) (Python committer) Date: 2004-08-07 18:30
Logged In: YES 
user_id=6656

__getnewargs__ is documented in

    http://docs.python.org/lib/pickle-inst.html#l2h-642

__new__ is documented in 

    http://www.python.org/2.2.2/descrintro.html

(that the documentation of new-style classes needs to be 
integrated into the main documentation is not news).

The same page will hopefully explain __mro__ and mro() too.
msg21978 - (view) Author: Colin J. Williams (cjwhrh) Date: 2004-08-07 23:55
Logged In: YES 
user_id=285587

Thanks Michael,

mro is defined in the Simionato paper.  The key is "
including the class itself".

The __new__ is not exactly defined, but is clear enough in
the GVD paper.

I'm afraid I found the material on __getnewargs__
incomprehesible.

Could I suggest that a note be put in the main docs that
these terms will be defined?

Colin W.
History
Date User Action Args
2022-04-11 14:56:06adminsetgithub: 40703
2004-08-06 16:01:40cjwhrhcreate

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant