Nathaniel Manista <nathan...@google.com> added the comment:

> In 3.4, format_list() was documented to accept return values of extract_tb() 
> > and extract_stack() functions and they both were returned lists:
> 
>     def extract_tb(tb, limit=None):
>         return list(_extract_tb_iter(tb, limit=limit))
> 
>     def extract_stack(f=None, limit=None):
>         stack = list(_extract_stack_iter(_get_stack(f), limit=limit))
>         stack.reverse()
>         return stack

I think that’s an unnecessarily and extraordinarily narrow reading - you could 
use the same reading to make a judgement of “format_list may only be passed 
values returned by extract_tb and extract_stack rather than other values of the 
same type”, and that would be absurd.

I don’t think it’s a wise choice to say “because the motivation for offering 
the format_list function was to work with values returned by extract_tb and 
extract_stack, the allowed inputs to format_list should be restricted to just 
those types”.

Why not support Iterable[FrameSummary]? A choice to support 
Iterable[FrameSummary] *is also a choice to support List[FrameSummary]*. It's 
just a "wider" choice; it’s not a breaking choice to drop support for 
List[FrameSummary].

> I don't think we support the "pass manually created iterables" case here.

What’s a “manually created iterable”? What kinds of iterables aren’t “manually 
created iterables”? Can their differences be captured in the type system?

> Yes, the old API is still supported for backwards compatibility reasons.

This is a very flat statement that invites questions by what it doesn’t say and 
by the way it describes something that is true today without saying for how 
long into the future that thing will remain true. For how long will the old API 
be supported for backwards compatibility reasons? Is new code encouraged to use 
the new API? If the new API is better, shouldn’t new code use it? If the new 
API isn’t better, why was it introduced?

----------

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

Reply via email to