The difference is whether or not you're the owner of the array. If you've accepted the array from some public location, even if it was a params method, someone else could own the array and continue to modify it. If you've created the array yourself or can guarantee it won't change then it can safely be used for the underlying object array for the List object.
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dan Eloff Sent: Saturday, October 11, 2008 1:29 PM To: Discussion of IronPython Subject: [IronPython] Why would you use MakeList over MakeListNoCopy? /// <summary> /// Python runtime helper to create a populated instance of Python List object. /// </summary> public static List MakeList(params object[] items) { return new List(items); } /// <summary> /// Python runtime helper to create a populated instance of Python List object w/o /// copying the array contents. /// </summary> [NoSideEffects] public static List MakeListNoCopy(params object[] items) { return List.FromArrayNoCopy(items); } If the second method "just works" then why would you ever want to use MakeList? I seem to be creating a lot of 1 and 2 item lists here, so I'm looking to make good use of one of these guys. (I really miss C# 3.0 collection initializers) Work on porting _ast is going well, so far I've had no insurmountable obstacles. I expect to be done it by Monday. The AST produced is close (but not identical) to CPython, but that shouldn't matter. Each node has the same properties with the exact same types so walking the tree should work equally on both platforms. Thanks, -Dan _______________________________________________ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com