Re: mutate dictionary or list

2010-09-08 Thread Paul McGuire
On Sep 7, 7:05 am, Baba wrote: > Hi > > I am working on an exercise which requires me to write a funtion that > will check if a given word can be found in a given dictionary (the > hand). > > def is_valid_word(word, hand, word_list): >     """ >     Returns True if word is in the word_list and is

Re: mutate dictionary or list

2010-09-08 Thread Baba
On 7 sep, 16:46, Ben Finney wrote: > de...@web.de writes: > > Objects can be mutable or immutable. For example, in Python, integers, > > strings, floats and tuples are immutable. That means that you can't > > change their value. > > Yes. Importantly, wherever you see code that you *think* is chang

Re: mutate dictionary or list

2010-09-07 Thread Ben Finney
de...@web.de writes: > Objects can be mutable or immutable. For example, in Python, integers, > strings, floats and tuples are immutable. That means that you can't > change their value. Yes. Importantly, wherever you see code that you *think* is changing the value of an immutable object, you're t

Re: mutate dictionary or list

2010-09-07 Thread deets
Baba writes: > Hi > > I am working on an exercise which requires me to write a funtion that > will check if a given word can be found in a given dictionary (the > hand). > > def is_valid_word(word, hand, word_list): > """ > Returns True if word is in the word_list and is entirely > co

Re: mutate dictionary or list

2010-09-07 Thread Bruno Desthuilliers
Baba a écrit : Hi I am working on an exercise which requires me to write a funtion that will check if a given word can be found in a given dictionary (the hand). def is_valid_word(word, hand, word_list): """ Returns True if word is in the word_list and is entirely composed of letter

Re: mutate dictionary or list

2010-09-07 Thread Xavier Ho
On 7 September 2010 22:05, Baba wrote: > > It would be great if someone could give me a brief explanantion of the > mutation concept. > In this case, to mutate is to change. If you must not mutate the list, you must not change it. In another words, reading from the list is fine. Writing to it i

mutate dictionary or list

2010-09-07 Thread Baba
Hi I am working on an exercise which requires me to write a funtion that will check if a given word can be found in a given dictionary (the hand). def is_valid_word(word, hand, word_list): """ Returns True if word is in the word_list and is entirely composed of letters in the hand. Ot