Multi-dimensional list initialization
andrew3 at r3dsolutions.com
Tue Nov 6 22:19:51 CET 2012
On 11/06/2012 09:32 AM, Prasad, Ramit wrote:
> Ian Kelly wrote:
>> On Tue, Nov 6, 2012 at 1:21 AM, Andrew Robinson
>>> See if you can find *any* python program where people desired the
>>> multiplication to have the die effect that changing an object in one of the
>>> sub lists -- changes all the objects in the other sub lists.
>>> I'm sure you're not going to find it -- and even if you do, it's going to be
>>> 1 program in 1000's.
>> Per the last thread where we discussed extremely rare scenarios,
>> shouldn't you be rounding "1 in 1000s" up to 20%? ;-)
:D -- Ian -- also consider that I *am* willing to use extra memory.
Not everything can be shrunk to nothing and still remain functional. :)
So, it isn't *all* about *micro* optimization -- it's also about
psychology and flexibility.
> Actually, I would be surprised if it was even 1 in 1000.
> Of course, consistency makes it easier to learn and *remember*.
> I value that far more than a minor quirk that is unlikely to
> bother me now that I know of it. Well, at least not as long as
> I do not forget my morning coffee/tea :)
But, having it copy lists -- when the only purpose of multiplication is
is only a minor quirk as well.
More information about the Python-list