[Tutor] one line code
Kent Johnson
kent37 at tds.net
Tue Apr 5 15:26:27 CEST 2005
Pierre Barbier de Reuille wrote:
> alan.gauld at freenet.co.uk a écrit :
>
>>> This is a perfect opportunity to give the reminder that the
>>> conversion functions are also types that can be used more
>>> transparently for such
>>
>> Neat I didn't know\ that. How dioes Python equate a function object
>> to a type? Is it hard wired?
>
> No, you see it the wrong way !
> "int" is a type, not a function ! But, in Python, types append to be
> callable (ie. to behave like functions).
Yes, that's right. int was changed from a function to a type in Python 2.2 as part of the
introduction of new-style classes. See
http://www.python.org/doc/2.2.3/whatsnew/sect-rellinks.html#SECTION000310000000000000000
Kent
More information about the Tutor
mailing list