Re: [Tutor] list method help

2006-02-03 Thread Alan Gauld
> > You definitely have to stop thinking of variables as containers. They > > are pointers or references to values. Another way to think of this is > > that variables are names for things. > Kent that's a perfectly understandable and easy to grasp analogy. But it > stays just an analogy ;-) Nope.

Re: [Tutor] list method help

2006-02-03 Thread Danny Yoo
> > But this assignment sort of puzzles me to why it's done like this > > (maybe cuz I am not used to it and can not see beyond my own > > experience in coding (having a blind spot or something like that)). If we have a snippet of code like: ### def test(): x = [] f(x) print

Re: [Tutor] list method help

2006-02-03 Thread Kent Johnson
Rinzwind wrote: > On 2/3/06, *Kent Johnson* <[EMAIL PROTECTED] > > wrote: > You definitely have to stop thinking of variables as containers. They > are pointers or references to values. Another way to think of this is > that variables are names for things. You

Re: [Tutor] list method help

2006-02-03 Thread Rinzwind
On 2/3/06, Kent Johnson <[EMAIL PROTECTED]> wrote: > On 2/3/06, Chris or Leslie Smith <[EMAIL PROTECTED]> wrote:>>Others could give you a really good answer. I am a BASIC/FORTRAN writer >>myself, and getting used to the *object* orientation of python took a little >>while, but after you get the ha

Re: [Tutor] list method help

2006-02-03 Thread Kent Johnson
> On 2/3/06, Chris or Leslie Smith <[EMAIL PROTECTED]> wrote: >>Others could give you a really good answer. I am a BASIC/FORTRAN writer >>myself, and getting used to the *object* orientation of python took a little >>while, but after you get the hang of it, it's not bad. In BASIC you think of >>var

Re: [Tutor] list method help

2006-02-03 Thread Rinzwind
On 2/3/06, Chris or Leslie Smith <[EMAIL PROTECTED]> wrote: > Rinzwind wrote: > | Well Chris or Leslie Smith. > | > | This bit l[:]=l[-1:]+l[0:-1] I think is VERY elegant. When I saw this > | in your post I tought: DUH. > | I did the same with 1 line more but I am still new to python ;) > | > You'r

Re: [Tutor] list method help

2006-02-02 Thread Chris or Leslie Smith
| Hello, | was just trying to do something and tried the following code: | | list = ["1", "test", "1.5"] | | for x in list: | print list.pop(x) | | I get the following error: | | print list.pop(x) | TypeError: an integer is required | | Does this mean i can't use a for loop to po

Re: [Tutor] list method help

2006-02-02 Thread Danny Yoo
On Thu, 2 Feb 2006, Michael Haft wrote: > was just trying to do something and tried the following code: > > list = ["1", "test", "1.5"] > > for x in list: > print list.pop(x) > > I get the following error: > > print list.pop(x) > TypeError: an integer is required Hi Michael, Th

Re: [Tutor] list method help

2006-02-02 Thread Alan Gauld
> list = ["1", "test", "1.5"] > for x in list: > print list.pop(x) > > I get the following error: > > print list.pop(x) > TypeError: an integer is required > > Does this mean i can't use a for loop to pop things from a list? No it means pop takes an optional *index* as an argument. > list

[Tutor] list method help

2006-02-02 Thread Michael Haft
Hello, was just trying to do something and tried the following code: list = ["1", "test", "1.5"] for x in list: print list.pop(x) I get the following error: print list.pop(x) TypeError: an integer is required Does this mean i can't use a for loop to pop things from a list? or