Sergey added the comment:

> I guess such implementation of tuple will increase memory usage
> and creation time which are critical important for tuples.

On the contrary, it will reduce memory usage and creation time compared to 
regular tuples, because in cases like:
  c = a + b
you do not have to spend time and memory for allocating and copying elements of 
"a".

The only case when it could use more memory is if you explicitly delete "c" 
after that operation. But this can be solved too, internal storage can be 
resized to a smaller value when its tail elements are not used any more.

This idea can be improved in many ways. For example it's possible to implement 
__add__ in C so that it would require no additional memory at all. But it is 
just a proof of concept, and I was trying to keep it simple, so the idea was 
easier to understand.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18305>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to