Default Value

MRAB python at mrabarnett.plus.com
Fri Jun 21 21:54:50 EDT 2013


On 22/06/2013 00:51, Rick Johnson wrote:
> On Friday, June 21, 2013 5:49:51 PM UTC-5, MRAB wrote:
>> I notice that you've omitted any mention of how you'd know that the
>> argument was mutable.
>
> My argument has always been that mutables should not be
> passed into subroutines as default arguments because bad
> things can happen. And Python's excuse of saving the poor
> dummies is no excuse.
>
> It does not matter if we are passing the arguments into the
> current implementation of "python functions which maintain
> state of default mutables arguments between successive
> calls" or in a more desirable system of truly "stateless
> subroutines".
>
> I also believe that a programmer should not be prevented
> from passing mutable default arguments, but if he does, I'm
> not going to provide any sort of protection -- other than
> possibly throwing up a warning message.
>
So, having mutables as default arguments is a bad idea, but a
programmer should not be prevented from doing that, and a warning
message should be printed on such occasions.

> Now, YOU, and everyone else, cannot destroy the main points
> of my argument because the points are in fact rock solid,
> however, what you will do is to focus in one small detail,
> one little tiny (perceived) weakness in the armor, and you
> will proceed to destroy that small detail (in this case how
> i will determine mutability), and hope that the destruction
> of this insignificant detail will start a chain-reaction
> that will propagate out and bring down my entire position.
>
In order to print a warning, Python needs to know whether the object is
mutable, so it's an important detail.

> So you want me to tell you how to query the mutability of an
> object... Ha Ha Ha! Sorry, but that's not going to happen!
>
It's a detail that you're not going to help to solve.

> Why should i help the developers of this language. What have
> they done for me?
>
They've developed this language, and provided it for free. They've even
released the source code.

You perceive flaws that you say must be fixed, but you're not going to
help to fix them.

> WOULD YOU OFFER ASSISTANCE TO PEOPLE THAT HAVE TREATED YOU THIS WAY?
>
> And let's just be honest. You don't want my assistance. You
> just want me to fumble the ball. Then you can use that
> fumble as an excuse to write me off. Nice try!
>
I _do_ want you to help to improve the language, and I don't care if
you don't get it right first time. I didn't get it right first time
when I worked on the regex module (I think that what I have on PyPI is
my _third_ attempt!).

> You want to gain my respect? Then start engaging in honest
> debates. Start admitting that yes, somethings about Python
> are not only undesirable, they're just plain wrong.
>
Python isn't perfect, but then no language is perfect. There will
always be compromises, and the need to maintain backwards compatibility
means that we're stuck with some "mis-features", but I think it's still
worth using; I still much prefer it to other languages.

> Stop calling me a troll when i am not. And not just me, stop
> calling other people trolls too! Stop using the personal
> attacks and straw man arguments.
>
???

> Finally, get the core devs to realize that this list matters
> and they need to participate (including you know who!)
>
Everyone is a volunteer. The core devs contribute by developing the
language, and whether they participate in this particular list is
entirely up to them; how they choose to spend _their own_ free time is,
again, entirely up to them.



More information about the Python-list mailing list