On 2/10/2012 10:14 AM, Nathan Rice wrote:
Lets also not forget that knowing an object is immutable lets you do a
lot of optimizations; it can be inlined, it is safe to convert to a
contiguous block of memory and stuff in cache, etc.  If you know the
input to a function is guaranteed to be frozen you can just go crazy.
Being able to freeze(anyobject) seems like a pretty clear win.
Whether or not it is pythonic is debatable.  I'd argue if the meaning
of pythonic in some context is limiting, we should consider updating
the term rather than being dogmatic.

    A real justification for the ability to make anything immutable is
to make it safely shareable between threads.  If it's immutable, it
doesn't have to be locked for access.  Mozilla's new "Rust"
language takes advantage of this.  Take a look at Rust's concurrency
semantics.  They've made some progress.

                                        John Nagle

                        
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to