[Python-checkins] cpython: Fix closes Issue11281 - smtplib.STMP gets source_address parameter, which adds

Antoine Pitrou solipsis at pitrou.net
Sun Jul 31 15:04:38 CEST 2011


On 2011年7月31日 09:26:33 +0800
Senthil Kumaran <senthil at uthcode.com> wrote:
> I found that [, timeout] bit odd too. But is not mentioning that as
> timeout=None when it is timeout=socket._GLOBAL_DEFAULT_TIME
> technically inaccurate?
>> FWIW, I see similar style (...,[,timeout], kw=val) adopted elsewhere
> in the library docs too. urllib, httplib, nntplib etc. Though it does
> not look okay, it is better than giving inaccurate information.

Indeed, we don't want to document the private sentinel object.
> While ftplib and poplib, has them as timeout=None, while they default
> to socket._GLOBAL_DEFAULT_TIMEOUT object.

This is wrong; someone may pass None thinking it will trigger the
default behaviour, and have nasty surprises.
> 3. def somesocketmethod(arg1,arg2[,timeout], kwarg=value)

However weird-looking, I think this is the correct solution here.
Regards
Antoine.


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /