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

rantingrick rantingrick at gmail.com
Tue Jul 5 07:42:39 EDT 2011


On Jul 4, 2:36 am, Gregory Ewing <greg.ew... at canterbury.ac.nz> wrote:

> We have different languages because different people have different
> ideas about what a language should be like. Ruby people like user
> defined control structures; Python people regard user defined
> control structures as an anti-feature. It's fundamentally
> impossible for one language to satisfy both sets of people.

I was thinking more about this comment and it occurred to me that
Python does have user controlled data structures. Just because there
is no "top level syntax" like ruby does not mean these do not exists.
You only have to look below the surface. Take the sort methods of
lists for example...

>>> lst = [
	(100, 0),
	(25, 2),
	(10,1),
	]
>>> lst
[(100, 0), (25, 2), (10, 1)]
>>> lst.sort()
>>> lst
[(10, 1), (25, 2), (100, 0)]
>>> lst.sort(lambda x,y: cmp(x[1], y[1]))
>>> lst
[(100, 0), (10, 1), (25, 2)]

...that looks like a "user defined control" structure to me. So how
can an anti-feature become part of the language proper? (devils
advocate here) :)

I leave the discovery of other user defined control structures for the
advanced readers.



More information about the Python-list mailing list