From: Pascal Chambon <chambon.pas...@wanadoo.fr>
Date: Wed, 13 May 2009 23:09:27 +0200
Local: Wed, May 13 2009 5:09 pm
Subject: Re: [Python-ideas] Default arguments in Python - the return - running out of ideas but...
Greg Falcon a écrit :
> Notice that Aowh... I didn't even think this was legal, but indeed this works... so > def foo(): > already has a meaning in Python. Under your proposal, it's obviously dead for "yield". > Anyhow, since you've decided you want add a new kind of default Well, not only do we have to write more code, but we lose in > argument spelled differently than the standard one, I have to ask what > this buys you beyond > def foo(): > Sure, it takes two more lines of code to write this (three if you want > Greg F self-documentation I guess (I'd rather have the default appearing in the signature than in the function code - pydoc and stuffs won't notice it), and I find slightly disappointing the principle of a "sentinel", i.e "I would have wanted to do something there but I can't so I'll do it farther, take that in the meantime". > There's the suggestion that Carl Johnson gave: Those phrases could do it, I'm just worryied about the fact that > def myfunc(a, b, c else []): > or there's: > def myfunc(a, b, c def []): > where 'def' stands for 'default' (or "defaults to"). semantically, they make (to me) no difference with "c = []". None of those ways looks more "dynamic" than teh other, so it might be hard to explain why "=" means compiel time, and "def" means runtime. I must admit I'm totally out of ideas then. Regards, _______________________________________________ You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||