Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #8843
| Subject | Re: The end to all language wars and the great unity API to come! |
|---|---|
| From | Corey Richardson <kb1pkl@aim.com> |
| References | (5 earlier) <6dd92755-c8e9-47ef-aa08-ffffbc3d1893@5g2000yqb.googlegroups.com> <97a7q6FtqcU1@mid.individual.net> <6a9373cd-4b27-447a-8be4-db74effde338@g16g2000yqg.googlegroups.com> <97d8spFg2nU1@mid.individual.net> <22a13bda-899d-4765-a03c-f8a36efaf905@34g2000yqr.googlegroups.com> |
| Date | 2011-07-05 12:04 -0400 |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.638.1309882223.1164.python-list@python.org> (permalink) |
[Multipart message — attachments visible in raw view] - view raw
Excerpts from rantingrick's message of Tue Jul 05 07:42:39 -0400 2011:
>
> 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) :)
>
How is giving the sort method a function by which to determine the relative
value of objects a control structure? Do you know what a control structure is?
It's something that you use to modify control flow:
if foo <= bar:
foo += 1
else:
bar += 1
That's a control structurem the "if-else". I don't know what Ruby calls a
control structure, but that's what it is. for and while are in there too.
When you run lst.sort(lambda x, y: cmp(x[1], y[1])), what happens?
We'll call that argument srt, here's a sample (naive) implementation:
def sort(key):
lst = self.internal_list
for n in range(len(self.internal_list) - 1):
for i in range(len(self.internal_list) - 1):
if srt(lst[i], lst[i+1]) < 0:
lst[i], lst[i+1] = lst[i+1], lst[i]
Untested, probably doesn't work either. See what's in there? An if. Nothing
"user-defined" at all. Sure, WHAT the if does is user-controlled with the
key, but that doesn't make that particular if a new control structure, and
it certainly doesn't make the key a control structure. You can pass a key
to a sort even in C and that certainly doesn't have user defined control
structures.
--
Corey Richardson
"Those who deny freedom to others, deserve it not for themselves"
-- Abraham Lincoln
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
The end to all language wars and the great unity API to come! rantingrick <rantingrick@gmail.com> - 2011-07-02 15:59 -0700
Re: The end to all language wars and the great unity API to come! Chris Angelico <rosuav@gmail.com> - 2011-07-03 09:38 +1000
Re: The end to all language wars and the great unity API to come! rantingrick <rantingrick@gmail.com> - 2011-07-02 16:46 -0700
Re: The end to all language wars and the great unity API to come! Tim Chase <python.list@tim.thechases.com> - 2011-07-02 20:09 -0500
Re: The end to all language wars and the great unity API to come! rantingrick <rantingrick@gmail.com> - 2011-07-02 17:21 -0700
Re: The end to all language wars and the great unity API to come! Chris Angelico <rosuav@gmail.com> - 2011-07-03 10:36 +1000
Re: The end to all language wars and the great unity API to come! Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-07-03 16:06 +1200
Re: The end to all language wars and the great unity API to come! rantingrick <rantingrick@gmail.com> - 2011-07-02 17:58 -0700
Re: The end to all language wars and the great unity API to come! Chris Angelico <rosuav@gmail.com> - 2011-07-03 11:12 +1000
Re: The end to all language wars and the great unity API to come! rantingrick <rantingrick@gmail.com> - 2011-07-02 18:43 -0700
Re: The end to all language wars and the great unity API to come! Chris Angelico <rosuav@gmail.com> - 2011-07-03 11:49 +1000
Re: The end to all language wars and the great unity API to come! rantingrick <rantingrick@gmail.com> - 2011-07-02 19:24 -0700
Re: The end to all language wars and the great unity API to come! Chris Angelico <rosuav@gmail.com> - 2011-07-03 13:14 +1000
Re: The end to all language wars and the great unity API to come! rantingrick <rantingrick@gmail.com> - 2011-07-02 21:13 -0700
Re: The end to all language wars and the great unity API to come! rantingrick <rantingrick@gmail.com> - 2011-07-02 19:08 -0700
Re: The end to all language wars and the great unity API to come! Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-07-03 15:57 +1200
Re: The end to all language wars and the great unity API to come! rantingrick <rantingrick@gmail.com> - 2011-07-02 21:34 -0700
Re: The end to all language wars and the great unity API to come! Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-03 14:46 +1000
Re: The end to all language wars and the great unity API to come! Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2011-07-03 02:59 -0700
Re: The end to all language wars and the great unity API to come! Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-07-03 16:00 +1200
Re: The end to all language wars and the great unity API to come! rantingrick <rantingrick@gmail.com> - 2011-07-02 21:42 -0700
Re: The end to all language wars and the great unity API to come! alex23 <wuwei23@gmail.com> - 2011-07-03 22:06 -0700
Re: The end to all language wars and the great unity API to come! rantingrick <rantingrick@gmail.com> - 2011-07-04 09:35 -0700
Re: The end to all language wars and the great unity API to come! Chris Angelico <rosuav@gmail.com> - 2011-07-05 03:19 +1000
Re: The end to all language wars and the great unity API to come! Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-05 09:24 +1000
Re: The end to all language wars and the great unity API to come! Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2011-07-04 19:09 -0700
Re: The end to all language wars and the great unity API to come! rantingrick <rantingrick@gmail.com> - 2011-07-05 18:07 -0700
Re: The end to all language wars and the great unity API to come! Chris Angelico <rosuav@gmail.com> - 2011-07-06 12:31 +1000
Microsoft GUIs (was: The end to all language wars and the great unity API to come!) (OT) Andrew Berg <bahamutzero8825@gmail.com> - 2011-07-05 23:13 -0500
Re: Microsoft GUIs (was: The end to all language wars and the great unity API to come!) (OT) Chris Angelico <rosuav@gmail.com> - 2011-07-06 14:25 +1000
Re: Microsoft GUIs Andrew Berg <bahamutzero8825@gmail.com> - 2011-07-05 23:53 -0500
Re: Microsoft GUIs Andrew Berg <bahamutzero8825@gmail.com> - 2011-07-06 00:29 -0500
Re: The end to all language wars and the great unity API to come! Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2011-07-05 22:26 -0700
Re: Microsoft GUIs Chris Angelico <rosuav@gmail.com> - 2011-07-06 15:43 +1000
Re: The end to all language wars and the great unity API to come! Chris Angelico <rosuav@gmail.com> - 2011-07-06 15:47 +1000
Re: The end to all language wars and the great unity API to come! Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-07-06 19:15 +1200
Re: The end to all language wars and the great unity API to come! Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-06 21:46 +1000
Re: The end to all language wars and the great unity API to come! Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2011-07-06 09:55 -0700
Re: The end to all language wars and the great unity API to come! alex23 <wuwei23@gmail.com> - 2011-07-04 19:31 -0700
Re: The end to all language wars and the great unity API to come! sal migondis <salmig99@gmail.com> - 2011-07-05 11:14 -0700
Re: The end to all language wars and the great unity API to come! Andrew Berg <bahamutzero8825@gmail.com> - 2011-07-05 16:01 -0500
Re: The end to all language wars and the great unity API to come! Chris Angelico <rosuav@gmail.com> - 2011-07-06 08:36 +1000
Re: The end to all language wars and the great unity API to come! Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2011-07-05 22:26 -0700
Re: The end to all language wars and the great unity API to come! Ben Finney <ben+python@benfinney.id.au> - 2011-07-07 15:10 +1000
Re: The end to all language wars and the great unity API to come! Andrew Berg <bahamutzero8825@gmail.com> - 2011-07-06 00:37 -0500
Re: The end to all language wars and the great unity API to come! Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-06 21:45 +1000
Re: The end to all language wars and the great unity API to come! sal migondis <salmig99@gmail.com> - 2011-07-08 12:05 -0700
Re: The end to all language wars and the great unity API to come! Ian Kelly <ian.g.kelly@gmail.com> - 2011-07-08 13:21 -0600
Re: The end to all language wars and the great unity API to come! alex23 <wuwei23@gmail.com> - 2011-07-04 19:36 -0700
Re: The end to all language wars and the great unity API to come! Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-07-04 19:36 +1200
Re: The end to all language wars and the great unity API to come! rantingrick <rantingrick@gmail.com> - 2011-07-05 04:42 -0700
Re: The end to all language wars and the great unity API to come! Corey Richardson <kb1pkl@aim.com> - 2011-07-05 12:04 -0400
Re: The end to all language wars and the great unity API to come! rantingrick <rantingrick@gmail.com> - 2011-07-05 15:35 -0700
Re: The end to all language wars and the great unity API to come! Chris Angelico <rosuav@gmail.com> - 2011-07-06 08:49 +1000
Re: The end to all language wars and the great unity API to come! Tim Chase <python.list@tim.thechases.com> - 2011-07-05 18:21 -0500
Re: The end to all language wars and the great unity API to come! Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-06 21:44 +1000
Re: The end to all language wars and the great unity API to come! rantingrick <rantingrick@gmail.com> - 2011-07-06 06:41 -0700
Re: The end to all language wars and the great unity API to come! Chris Angelico <rosuav@gmail.com> - 2011-07-06 23:52 +1000
Re: The end to all language wars and the great unity API to come! Neil Cerutti <neilc@norwich.edu> - 2011-07-06 15:13 +0000
Re: The end to all language wars and the great unity API to come! Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-07 00:55 +1000
Re: The end to all language wars and the great unity API to come! rantingrick <rantingrick@gmail.com> - 2011-07-06 08:33 -0700
Re: The end to all language wars and the great unity API to come! Teemu Likonen <tlikonen@iki.fi> - 2011-07-06 19:55 +0300
Re: The end to all language wars and the great unity API to come! Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-07-06 19:05 +1200
Re: The end to all language wars and the great unity API to come! Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-03 13:21 +1000
csiph-web