marduk <[EMAIL PROTECTED]> wrote:

> By design, %s "converts any python object using str()".  OTOH it does
> not specify that %d, for example, calls int().

No, but it does say that the 'd' is a conversion type meaning 'signed 
integer decimal', and indeed anything which has an __int__ method may be 
passed to the %d formatter:

>>> class C:
        def __int__(self):
                return 42

        
>>> "%d" % C()
'42'
>>> "%d" % 3.5
'3'
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to