Why is the interpreter is returning a 'reference'?

2014-02-17 Thread Nir
k = ['hi','boss'] k ['hi', 'boss'] k= [s.upper for s in k] k [built-in method upper of str object at 0x021B2AF8, built-in method upper of str object at 0x02283F58] Why doesn't the python interpreter just return ['HI, 'BOSS'] ? This isn't a big deal, but I am just curious as

Re: Why is the interpreter is returning a 'reference'?

2014-02-17 Thread Joel Goldstick
On Feb 17, 2014 12:05 PM, Nir nircher...@gmail.com wrote: k = ['hi','boss'] k ['hi', 'boss'] k= [s.upper for s in k S.upper() k [built-in method upper of str object at 0x021B2AF8, built-in method upper of str object at 0x02283F58] Why doesn't the python interpreter

Re: Why is the interpreter is returning a 'reference'?

2014-02-17 Thread Ned Batchelder
On 2/17/14 12:00 PM, Nir wrote: k = ['hi','boss'] k ['hi', 'boss'] k= [s.upper for s in k] k [built-in method upper of str object at 0x021B2AF8, built-in method upper of str object at 0x02283F58] Why doesn't the python interpreter just return ['HI, 'BOSS'] ? This isn't a

Re: Why is the interpreter is returning a 'reference'?

2014-02-17 Thread emile
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 0x021B2AF8, built-in method upper of

Re: Why is the interpreter is returning a 'reference'?

2014-02-17 Thread Marko Rauhamaa
Nir nircher...@gmail.com: k= [s.upper for s in k] k [built-in method upper of str object at 0x021B2AF8, built-in method upper of str object at 0x02283F58] Why doesn't the python interpreter just return ['HI, 'BOSS'] ? Try: k = [ s.upper() for s in k ] Marko --

Re: Why is the interpreter is returning a 'reference'?

2014-02-17 Thread Zachary Ware
On Mon, Feb 17, 2014 at 11:00 AM, Nir nircher...@gmail.com wrote: k = ['hi','boss'] k ['hi', 'boss'] k= [s.upper for s in k] k [built-in method upper of str object at 0x021B2AF8, built-in method upper of str object at 0x02283F58] Why doesn't the python interpreter just

Re: Why is the interpreter is returning a 'reference'?

2014-02-17 Thread John Gordon
In 9b80c233-ad31-44c8-8a6e-9002ab11b...@googlegroups.com Nir nircher...@gmail.com writes: k = ['hi','boss'] k ['hi', 'boss'] k= [s.upper for s in k] k [built-in method upper of str object at 0x021B2AF8, built-in method upper of str object at 0x02283F58] Why