On 02/17/2014 09:00 AM, Nir wrote:
k = ['hi','boss']

k
['hi', 'boss']
k= [s.upper for s in k]

s.upper is a reference to the method upper of s -- to execute the method add parens -- s.upper()

Emile


k
[<built-in method upper of str object at 0x00000000021B2AF8>, <built-in method 
upper of str object at 0x0000000002283F58>]

Why doesn't the python interpreter just return
['HI, 'BOSS'] ?

This isn't a big deal, but I am just curious as to why it does this.



--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to