[Python-Dev] trunc()

Steve Holden steve at holdenweb.com
Tue Jan 29 13:14:01 CET 2008


Jeffrey Yasskin wrote:
[...]
> Just like set(sequence) is the set associated with that sequence, not
> the set part of that sequence, and float('3.14') is the float
> associated with '3.14', not the float part of '3.14', etc. Type names
> do not normally retrieve pieces of other objects. 

 >>> type(object)
<type 'type'>
 >>> list({1:2, 3:4})
[1, 3]
 >>> set({1:2, 3:4})
set([1, 3])
 >>>

[...]

Surely the real issue here is that int() grew up purely as a conversion 
function, and metamorphosed into a type when the classic classes were 
moved into the background.

A brief scan of the 2.4 library (the nearest to hand) shows no uses of 
int() without an argument in the top level modules. There's clearly no 
point calling int() with a literal integer argument, so its uses for 
conversion clearly dominate its use as a pure type constructor.

regards
  Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC              http://www.holdenweb.com/



More information about the Python-Dev mailing list