Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • 4
    \$\begingroup\$ that's nice tip in general :) \$\endgroup\$ Commented Mar 20, 2014 at 20:11
  • 44
    \$\begingroup\$ Note that this will not necessarily work for defining mutable objects that you will be modifying in-place. a=b=[1] is actually different from a=[1];b=[1] \$\endgroup\$ Commented Apr 23, 2014 at 9:02
  • 8
    \$\begingroup\$ The funny thing about the first tip is that it works in Java too. \$\endgroup\$ Commented Apr 24, 2014 at 7:46
  • 3
    \$\begingroup\$ @Justin Yes, but only with primitive types \$\endgroup\$ Commented Sep 12, 2015 at 15:41
  • 28
    \$\begingroup\$ But NEVER use a=b=c=[] or any object instanciation since all the variables will point to the same instance. That's probably not what you want. \$\endgroup\$ Commented Aug 22, 2017 at 13:38