SV: Regarding coding style

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Sun Mar 9 01:36:36 CET 2008


On Sat, 08 Mar 2008 21:21:48 +0100, K Viltersten wrote:

> Coming from C++/Java camp i can't help noticing that in most cases, when
> i'm using a class written by somebody else, i don't want to see his/her
> code. I only want to know WHAT the function does (is intended to be
> doing, at least).
> 
> I don't want to look at the source code (in some cases i can't even see
> the code because it's compiled). I only care that when i execute
> 
>   SomeType obj = SomeType();
>   obj.aggregate();
> 
> the object gets aggregated. How it's done will be up to the author. I'm
> just a user of the product.
> 
> Now, i'm getting the signal that it's done in a different way in Python.
> Please elaborate. I'm very new to snakeology.


I think even Grant would agree that when you call "help(make_widget)", 
you should see something like:

    make_widget(styleID, material) -> widget or 
        raise ValueError on failure

        styleID: numeric ID or string name of the widget style
        material: WidgetMaterial instance or None to use default


rather than:

    See source code for details.



*wink*



-- 
Steven



More information about the Python-list mailing list