Re: mutate dictionary or list

2010-09-08 Thread Baba
On 7 sep, 16:46, Ben Finney ben+pyt...@benfinney.id.au 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

Re: mutate dictionary or list

2010-09-08 Thread Paul McGuire
On Sep 7, 7:05 am, Baba raoul...@gmail.com 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

Re: mutate dictionary or list

2010-09-07 Thread Xavier Ho
On 7 September 2010 22:05, Baba raoul...@gmail.com 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.

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 letters

Re: mutate dictionary or list

2010-09-07 Thread deets
Baba raoul...@gmail.com 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

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