[Tutor] Fwd: Re: would someone please explain this concept to me

Alan Gauld alan.gauld at yahoo.co.uk
Thu Jun 6 03:41:00 EDT 2019


On 06/06/2019 00:57, Alan Gauld via Tutor wrote:

> But in the second example you actially change the object
> that checklimit refers to.
> 
> checklimit = 22   # immutable value assigned
> feeds['bar'] = checklimit   # both refer to same immutable value
> base_var = 66   # now feeds refers to original object: 22
>                 # and checklimit refers to new object: 66

Oops, base_var should of course be checklimit!
I started out using base_var then changed it to checklimit
to match the original code.
But this one slipped through unchanged.
Sorry.


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list