[Python-ideas] Documenting Python warts

Steven D'Aprano steve at pearwood.info
Wed Jan 2 10:31:54 CET 2013


On 02/01/13 18:29, Antoine Pitrou wrote:
> On Wed, 2 Jan 2013 13:25:35 +1000
> Nick Coghlan<ncoghlan at gmail.com>  wrote:
>> On Wed, Jan 2, 2013 at 1:16 PM, Oleg Broytman<phd at phdru.name>  wrote:
>>> On Wed, Jan 02, 2013 at 11:07:58AM +1000, Nick Coghlan<ncoghlan at gmail.com>  wrote:
>>>> Mutable default arguments make perfect sense once you
>>>> understand the difference between compile time, definition time and
>>>> execution time for a function. Defaults are evaluated at definition
>>>> time, thus they are necessarily shared across all invocations of the
>>>> function.
>>>
>>>     I.e., users have to understand the current implementation. Mutable
>>> defaults are not a language design choice, they are dictated by the
>>> implementation, right?
>>
>> No, they're not an implementation accident, they're part of the
>> language design. It's OK if you don't like them, but please stop
>> claiming they're a CPython implementation artifact.
>
> Let's call them a compromise then, but calling them a language feature
> sounds delusional. I can't remember ever taking advantage of the fact
> that mutable default arguments are shared accross function invocations.

I've never taken advantage of multiprocessing. Does that mean that it is
"delusional" to call multiprocessing a feature?

On the other hand, I have made use of early binding of function defaults,
and consider it a good feature of the language. Early binding is not just
for mutable defaults.




-- 
Steven



More information about the Python-ideas mailing list