[Python-ideas] Short form for keyword arguments and dicts

Joshua Landau joshua.landau.ws at gmail.com
Sat Jun 22 22:07:01 CEST 2013


On 22 June 2013 20:51, Anders Hovmöller <boxed at killingar.net> wrote:
> Hmm, I wasn't aware that doing
>
> class Foo:
>    bar = bar
>
> was even valid python, blech. But that's a pretty contrived example. I'm not
> suggesting something huge and radical like totally redefining how assignment
> works :P I'm just suggesting a small change that I believe would have
> repercussions far above the weight class of the change itself. "It's the
> little things" and all that.

Yes, but consistency, y'know. Why "bar = bar ≡ = bar" here and "bar =
bar !≡ = bar" there?

>> I'm not convinced either.
>> I like the idea, but it's not that big a deal and I don't like your
>> proposed implementation.
>
>
> Well I think it is a big deal. I think Objective-C code bases are much
> easier to maintain because they have a superior syntax for calling methods.
> I don't like it when other languages do something as simple as calling
> functions better than my otherwise favorite language :P

I've skimmed a bit but I'm still unsure; why? How does Objective-C
deal with this?

>> There are so many more cases to cover and this doesn't fill them,
>
> Like what? At least name one so we can have a discussion about it!

One? Well, the one above!

I agree that classes seem a bit far-fetched (personally I dislike that
syntax) but what about:

def function(arg=arg):
    ...

def function(arg):
    self.arg = arg

thing = dictionary[thing]

and so on, which are all of the same form, albeit with different
"surroundings". We can't just double the whole syntax of Python for
this!

>> nor it's original one nicely.
>
> Ok. Why? I'm not saying you're wrong, I just want to know what the reasons
> are so I can understand why I was mistaken so I can forget about this idea
> :P

Does foo(=bar) not bug you?
Really?


More information about the Python-ideas mailing list