Serhiy Storchaka added the comment:

> Maybe we want a facility to create on-stack static-size tuples?

There is no guarantee that called function doesn't save the reference to args.

> How many functions can benefit from this approach, though?

>From hand-writing caching? Any function, that repeatedly call other functions 
>many times. In additional to sorted()/list.sort() with the key argument, 
>filter() and map(), these are min() and max() with the key argument, some 
>iterators from itertools (groupby(), dropwhile(), takewhile(), accumulate(), 
>filterfalse()). May be some functions that are thin wrappers around special 
>method (e.g. round()).

But it is more interesting to investigate why PyTuple_New() is so slow in 
comparison with hand-written caching. It it can be speeded up, then mauch more 
code can benefit from this.

----------

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

Reply via email to