On 06/26/2013 04:15 PM, Joshua Landau wrote:
On 26 June 2013 16:24, Ethan Furman <ethan@stoneleaf.us> wrote:
On 06/26/2013 07:46 AM, Joshua Landau wrote:
On 26 June 2013 09:04, Ethan Furman <ethan@stoneleaf.us> wrote:
A word doesn't stand out like a character does, plus this usage of pass is completely different from its normal usage.
We're already used to interpreting '*' as a coin with two sides, let's stick with it:
def apply_map(map, target, *, frobble): # '*' means frobble is keyword only ...
and later:
frobble = some_funny_stuff_here() . . . apply_map(map=kansas, target=toto, *, frobble) # '*' means frobble maps to keyword frobble
Whilst Greg Ewing has made me also much more sympathetic to this view, I feel that:
1) This is nearly unreadable - it does not say what it does in the slightest
And the '*' and '**' in function defintions do?
Yes. The "*" symbol means "unpack" across a very large part of python, and the lone "*" was a simple extension to what it already did. There was no leap; I could've guessed what it did. It does not mean "magically make an object know what its name is and then unpack both of those -- implicitly over all of the following args!".
Until recently the '*' meant 'pack' if it was in a function header, and 'unpack' if it was in a function call, and wasn't usable anywhere else. Now it also means 'unpack' in assignments, as well as 'keywords only after this spot' in function headers. Likewise with '**' (except for the assignments part). I don't know about you, but the first time I saw * and ** I had no idea what they did and had to learn it.
2) It's added syntax - that's a high barrier. I'm not convinced it's worth it yet.
It is a high barrier; but this does add a bit of symmetry to the new '*'-meaning-keyword-only symbol.
I don't think it does - there's no symmetry as they have completely different functions.
Like pack and unpack are completely different? ;) I see it as: function header: '*' means only keywords accepted after this point function call: '*' okay, here's my keywords ;)
3) It still feels like hackery; I might prefer something explicitly hackery like this:
You'll get used to it. ;)
I bet you I won't :P.
heheh -- ~Ethan~