The end to all language wars and the great unity API to come!

rantingrick rantingrick at
Sun Jul 3 06:34:55 CEST 2011

On Jul 2, 10:57 pm, Gregory Ewing <greg.ew... at> wrote:
> The place where this "Unity API" idea of yours falls down
> is that an API is only truly easy to use when it's designed
> to closely match the characteristics of the language it's
> being used from.
> For example, Python has a very powerful feature that most
> other languages don't have anything remotely like: very
> flexible keyword arguments.


>    win = Window(title = "Fred", width = 300, height = 100,
>      position = (30, 50), movable = True, resizable = True)

With all due respect that's a frail argument Greg. I agree that
python's keyword arguments are great but they can actually cause code
to get messy when so many are passed in a notation like you present
*ahem* ESPECIALLY when "somebody" refuses to follow the style guide

I would do this for clarity...

win = Window(
    position=(30, 50),

psst: removed python style guide abominations :-)
Strangely however it looks very similar to your next notation...

>    win = Window()
>    win.title = "Fred"
>    win.width = 300
>    win.height = 100
>    win.position = (30, 50)
>    win.movable = True
>    win.resizable = True

hmm? I think it's actually easier to read in this final form. However
i will agree that C's requirements for function parameters are a real
pain in the arse. Thank Guido for Python!

> Either way you end up with an API that feels very awkward
> when used from Python.

I think we need to provide a better example (than just mere
conjecture) before we assume how an "imaginary" API would "feel". And
don't forget, any API can feel awkward since you've only got the hooks
that the devs deemed worthy for you to have. I can't tell you how many
obstacles I've had to code around because an API was lacking or buggy.
Turned my otherwise beautiful code into an Orwellian nightmare.

More information about the Python-list mailing list