**** -- thats a really good point! I did not mean to do that! On Wed, Dec 9, 2015 at 3:25 PM, Ron McOuat <ron.mco...@gmail.com> wrote:
> Are you sure you want to do that? > > a = b = [] > > binds a and b to the same empty list object so whatever you do to a will > also appear in b because they both reference the same list object. > Assignment does not create a new object, it simply binds a variable name on > the left to the object on the right. > > Try this: > > a = b = [] > a.insert(0,2) > print a, b > > should print > [2] [2] > > A great source of bugs if a and b are thought to be different objects. > > Ron > > > On Tuesday, 8 December 2015 07:01:36 UTC-8, Mark Billion wrote: >> >> in python 2.6, I can run a = b = [] and get the expected result. In W2P, >> when I do it, it throws an exception as the list does not propagate to both >> a & b. It would make my code cleaner, but otherwise not a problem. Just >> wanted to give a shout in case anyone gave a .... >> >> Thanks again for all of your help! >> > -- > Resources: > - http://web2py.com > - http://web2py.com/book (Documentation) > - http://github.com/web2py/web2py (Source code) > - https://code.google.com/p/web2py/issues/list (Report Issues) > --- > You received this message because you are subscribed to a topic in the > Google Groups "web2py-users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/web2py/xCXgIDUZVnU/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- Mark M. Billion 1904 N. Lincoln Wilmington, DE 19806 302.416.2199 -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.