It is fun.the result of str.lower(str())

Fredrik Lundh fredrik at
Tue Mar 7 08:57:10 CET 2006

"Sullivan WxPyQtKinter" wrote:

> Guess what would be the result of these functions:
> >>>str.lower('ASFA')
> >>>str.join(str(),['1','1','1'])
> >>>str.join('a','b')
> If you guess them correctly, please explain.

as I just said, I.method() and C.method(I) are equivalent,
so that's just an odd way to write

    str().join(['1', '1', '1'])

which, given that str() returns an empty string, and a string
behaves like a sequence of individual characters, is equivalent

    'ASFA'.lower() => 'asfa'
    ''.join(['1', '1', '1']) => '111'
    'a'.join(['b']) => 'b'


More information about the Python-list mailing list