[Python-3000] PEP 3100 Comments

Talin talin at acm.org
Tue May 9 20:06:20 CEST 2006


Phillip J. Eby <pje <at> telecommunity.com> writes:

> Assuming we used argument declarations to do overloading, and that actual 
> types (other than 'object') are considered to be more specific than 
> typeclasses, you would have something like:
> 
>      @overloaded
>      def flatten(arg:supports(iter)):
>          for item in arg:
>              for flat in flatten(item):
>                  yield flat
> 
>      @overloaded
>      def flatten(arg:str):
>          yield arg
> 
>      @overloaded
>      def flatten(arg:object):
>          yield arg

I like it. This is exactly what I want. (Is that the same as
saying +1? Am I allowed to vote? :)

My only concern is that it seems that the current plans
for generic functions in Py3K are somewhat less than this.
So we either need to have something like this be doable
in Py3K, or we need to search for another solution.

Actually, there's one other concern, which is - how
efficient is this? Compared to, say, calling isSequence()?

-- Talin




More information about the Python-3000 mailing list