[Python-checkins] r43126 - in python/trunk: Doc/lib/libsocket.tex Lib/socket.py Lib/test/test_socket.py Misc/NEWS Modules/socketmodule.c
Guido van Rossum
guido at python.org
Tue Mar 21 01:17:00 CET 2006
On 3/20/06, "Martin v. Löwis" <martin at v.loewis.de> wrote:
> Guido van Rossum wrote:
> > Why are these accessor methods? A more Pythonic API would make them
> > read-only attributes, like the various attributes of file objects.
>
> This goes back to a patch comment from me, in python.org/sf/567972:
>
> """
> I also wonder what style of API should be used. All other
> state access goes through get-methods(), which all start
> with get except for fileno(). Adding properties would
> introduce another API style, so -1.
> """
>
> Not sure what I was thinking there - although fileno() *is*
> a function.
This is because fileno() is a function in C stdio.
> Looking into the library, I see many accessor
> functions starting with either get_ or get; however, I don't
> recall why that could have been relevant for socket objects.
>
> If you think that should be changed to attributes, we should
> do that.
Accessor functions are typical for APIs translated too literally from
Java. (threading.py being an example :-( )
I'd like to change this as long as we're doing greenfield API design.
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-checkins
mailing list