[docs] Function return types

Sven Brauch svenbrauch at googlemail.com
Sat Aug 13 00:38:58 CEST 2011


Hi there,

I see your point, but still there's not an infinite number of things a
function could return. For example, PIL.Image.new() will always give
an instance of the "Image" class, or len() will always return an
integer. In fact I think it's like this for most functions. Of course,
it's not possible to specify return types for a few exceptions, but
couldn't it be done for those functions where it's easily possible? I
think this would be an improvement.

Best regards,
Sven

2011/8/12 Sandro Tosi <sandro.tosi at gmail.com>:
> Hello Sven,
> thanks for your email.
>
> On Thu, Jun 2, 2011 at 21:50, Sven Brauch <svenbrauch at googlemail.com> wrote:
>> Hi there!
>>
>> I noticed there's no standard way on docs.python.org in which return
>> types of functions are specified. Sometimes the return type can be
>> read out of the description, sometimes it can't; but there's no easy
>> way to see what kind of data a function is likely to return. What do
>> you think about adding such an attribute? I'd be happy to help adding
>> those where it seems necessary.
>
> Python is a dynamic typing language, so it doesn't have the concept of
> "function return type" (a-la C or Java, where you define in your code
> what's the type that function will return), but it's the behavior of
> the returned object that defines what it is (duck typing)
>
> I'm sure you can find a lot of material on the web about it, but
> there's nothing to be fixed in the doc.
>
> Regards,
> --
> Sandro Tosi (aka morph, morpheus, matrixhasu)
> My website: http://matrixhasu.altervista.org/
> Me at Debian: http://wiki.debian.org/SandroTosi
>


More information about the docs mailing list