Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-23 Thread Timothy N. Tsvetkov
On Feb 16, 10:41 pm, Andrej Mitrovic wrote: > On Feb 16, 7:38 pm, Casey Hawthorne > wrote: > > > Interesting talk on Python vs. Ruby and how he would like Python to > > have just a bit more syntactic flexibility. > > >http://blog.extracheese.org/2010/02/pyt

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-23 Thread Anh Hai Trinh
On Feb 23, 1:03 pm, "Alf P. Steinbach" wrote: > > Uhm, Paganini... > > As I understand it he invented the "destroy your instruments on stage". :-) > > Cheers, > > - Alf (off-topic) You probably meant Franz Liszt, who regularly broke piano strings. Paganini was also a "rock-star" virtuoso but he d

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-22 Thread Alf P. Steinbach
* Paul Rubin: Steve Howell writes: My gut instinct is that functional programming works well for lots of medium sized problems and it is worth learning. I think it's worth learning because it will make you a better programmer even if you never use it for anything beyond academic exercises. I

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-22 Thread Steve Howell
On Feb 22, 9:06 pm, Paul Rubin wrote: > Steve Howell writes: > > My gut instinct is that functional programming works well for lots of > > medium sized problems and it is worth learning. > > I think it's worth learning because it will make you a better programmer > even if you never use it for an

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-22 Thread Steve Howell
On Feb 22, 9:11 pm, Steve Howell wrote: > On Feb 22, 8:35 pm, Jonathan Gardner > wrote: > > > > > On Mon, Feb 22, 2010 at 12:31 PM, John Bokma wrote: > > > > In my class there where basically 2 groups of people: the ones who got > > > functional programming and the ones who had a hard time with

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-22 Thread Paul Rubin
Steve Howell writes: > My gut instinct is that functional programming works well for lots of > medium sized problems and it is worth learning. I think it's worth learning because it will make you a better programmer even if you never use it for anything beyond academic exercises. It's just like

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-22 Thread Steve Howell
On Feb 22, 8:35 pm, Jonathan Gardner wrote: > On Mon, Feb 22, 2010 at 12:31 PM, John Bokma wrote: > > > In my class there where basically 2 groups of people: the ones who got > > functional programming and the ones who had a hard time with it. The > > latter group consisted mostly of people who h

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-22 Thread Jonathan Gardner
On Mon, Feb 22, 2010 at 12:31 PM, John Bokma wrote: > > In my class there where basically 2 groups of people: the ones who got > functional programming and the ones who had a hard time with it. The > latter group consisted mostly of people who had been programming in > languages like C and Pascal

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-22 Thread Lawrence D'Oliveiro
In message <3aa0205f-1e98-4376-92e4-607f96f13...@k19g2000yqc.googlegroups.com>, Michael Sparks wrote: > [1] This is perhaps more appropriate because '(a b c) is equivalent > to (quote a b c), and quote a b c can be viewed as close to > python's expression "lambda: a b c" You got to be k

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-22 Thread Paul Rubin
John Bokma writes: > In my class there where basically 2 groups of people: the ones who got > functional programming and the ones who had a hard time with it. The > latter group consisted mostly of people who had been programming in > languages like C and Pascal for years; they had a hard time thi

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-22 Thread Lawrence D'Oliveiro
In message <1ecc71bf-54ab-45e6-a38a-d1861f092...@v25g2000yqk.googlegroups.com>, sjdevn...@yahoo.com wrote: > On Feb 20, 1:30 am, Lawrence D'Oliveiro > wrote: > >> In message , Rhodri James wrote: >> >> > In classic Pascal, a procedure was distinct from a function in that it >> > had no return v

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-22 Thread John Bokma
Jonathan Gardner writes: > On Sun, Feb 21, 2010 at 10:22 AM, John Bokma wrote: >> Jonathan Gardner writes: >>> On Fri, Feb 19, 2010 at 11:16 PM, Lie Ryan wrote: Now, why don't we start a PEP to make python a fully-functional language then? >>> >>> Because people don't think the

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-22 Thread Paul Rubin
Jonathan Gardner writes: > I won't deny that really smart people enjoy the challenge of > programming in a functional style, and some even find it easier to > work with. However, when it comes to readability and maintenance, I > appreciate the statement-based programming style, simply because it's

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-22 Thread Jonathan Gardner
On Sun, Feb 21, 2010 at 10:22 AM, John Bokma wrote: > Jonathan Gardner writes: >> On Fri, Feb 19, 2010 at 11:16 PM, Lie Ryan wrote: >>> >>> Now, why don't we start a PEP to make python a fully-functional language >>> then? >> >> Because people don't think the same way that programs are written i

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-21 Thread John Bokma
Jonathan Gardner writes: > On Fri, Feb 19, 2010 at 11:16 PM, Lie Ryan wrote: >> >> Now, why don't we start a PEP to make python a fully-functional language >> then? > > Because people don't think the same way that programs are written in > functional languages. Heh! When I learned Miranda it fe

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-20 Thread Steve Howell
On Feb 20, 6:13 am, Michael Sparks wrote: > On Feb 18, 4:15 pm, Steve Howell wrote: > ... > > >     def print_numbers() > >         [1, 2, 3, 4, 5, 6].map { |n| > >             [n * n, n * n * n] > >         }.reject { |square, cube| > >             square == 25 || cube == 64 > >         }.map {

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-20 Thread Michael Sparks
On Feb 18, 4:15 pm, Steve Howell wrote: ... >     def print_numbers() >         [1, 2, 3, 4, 5, 6].map { |n| >             [n * n, n * n * n] >         }.reject { |square, cube| >             square == 25 || cube == 64 >         }.map { |square, cube| >             cube >         }.each { |n| >  

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-20 Thread Chris Rebert
On Fri, Feb 19, 2010 at 11:17 PM, sjdevn...@yahoo.com wrote: > On Feb 20, 1:30 am, Lawrence D'Oliveiro central.gen.new_zealand> wrote: >> If Python doesn’t distinguish between procedures and functions, why should >> it distinguish between statements and expressions? > > Because the latter are dif

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-20 Thread Jonathan Gardner
On Fri, Feb 19, 2010 at 11:16 PM, Lie Ryan wrote: > > Now, why don't we start a PEP to make python a fully-functional language > then? > Because people don't think the same way that programs are written in functional languages. -- Jonathan Gardner jgard...@jonathangardner.net -- http://mail.py

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-19 Thread Carl Banks
On Feb 19, 11:12 pm, Steve Holden wrote: > Ben Finney wrote: > > Lawrence D'Oliveiro writes: > > >> If Python doesn’t distinguish between procedures and functions, why > >> should it distinguish between statements and expressions? > > > I don't see the connection between those two predicates. Why

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-19 Thread Carl Banks
On Feb 19, 10:30 pm, Lawrence D'Oliveiro wrote: > In message , Rhodri James wrote: > > > In classic Pascal, a procedure was distinct from a function in that it had > > no return value.  The concept doesn't really apply in Python; there are no > > procedures in that sense, since if a function termi

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-19 Thread Lie Ryan
On 02/20/10 18:17, sjdevn...@yahoo.com wrote: > On Feb 20, 1:30 am, Lawrence D'Oliveiro central.gen.new_zealand> wrote: >> In message , Rhodri James wrote: >> >>> In classic Pascal, a procedure was distinct from a function in that it had >>> no return value. The concept doesn't really apply in Py

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-19 Thread Lie Ryan
On 02/20/10 17:30, Lawrence D'Oliveiro wrote: > In message , Rhodri James wrote: > >> In classic Pascal, a procedure was distinct from a function in that it had >> no return value. The concept doesn't really apply in Python; there are no >> procedures in that sense, since if a function terminates

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-19 Thread sjdevn...@yahoo.com
On Feb 20, 1:30 am, Lawrence D'Oliveiro wrote: > In message , Rhodri James wrote: > > > In classic Pascal, a procedure was distinct from a function in that it had > > no return value.  The concept doesn't really apply in Python; there are no > > procedures in that sense, since if a function termin

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-19 Thread sjdevn...@yahoo.com
On Feb 20, 1:28 am, Lawrence D'Oliveiro wrote: > In message <87eikjcuzk@benfinney.id.au>, Ben Finney wrote: > > > > > Lawrence D'Oliveiro writes: > > >> In message , cjw wrote: > > >> > Aren't lambda forms better described as function? > > >> Is this a function? > > >>     lambda : None > > >

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-19 Thread Steve Holden
Ben Finney wrote: > Lawrence D'Oliveiro writes: > >> If Python doesn’t distinguish between procedures and functions, why >> should it distinguish between statements and expressions? > > I don't see the connection between those two predicates. Why does the > former matter when determining the “sh

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-19 Thread Ben Finney
Lawrence D'Oliveiro writes: > If Python doesn’t distinguish between procedures and functions, why > should it distinguish between statements and expressions? I don't see the connection between those two predicates. Why does the former matter when determining the “should” of the latter? -- \

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-19 Thread Ben Finney
Lawrence D'Oliveiro writes: > So there is no distinction between functions and procedures, then? In Python, no. -- \ “When we pray to God we must be seeking nothing — nothing.” | `\ —Saint Francis of Assisi | _o__)

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-19 Thread Lawrence D'Oliveiro
In message , Rhodri James wrote: > In classic Pascal, a procedure was distinct from a function in that it had > no return value. The concept doesn't really apply in Python; there are no > procedures in that sense, since if a function terminates without supplying > an explicit return value it retu

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-19 Thread Lawrence D'Oliveiro
In message <84166541-c10a-47b5-ae5b- b23202624...@q2g2000pre.googlegroups.com>, Steve Howell wrote: > Some people make the definition of function more restrictive--"if it > has side effects, it is not a function." Does changing the contents of CPU cache count as a side-effect? -- http://mail.pyt

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-19 Thread Lawrence D'Oliveiro
In message <87eikjcuzk@benfinney.id.au>, Ben Finney wrote: > Lawrence D'Oliveiro writes: > >> In message , cjw wrote: >> >> > Aren't lambda forms better described as function? >> >> Is this a function? >> >> lambda : None >> >> What about this? >> >> lambda : sys.stdout.write("hi the

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-19 Thread Lie Ryan
On 02/19/10 14:57, Steve Howell wrote: > In a more real world example, the intermediate results would be > something like this: > >departments >departments_in_new_york >departments_in_new_york_not_on_bonus_cycle >employees_in_departments_in_new_york_not_on_bonus_cycle >names_of

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-19 Thread Steve Howell
On Feb 19, 9:30 am, Steven D'Aprano wrote: > On Fri, 19 Feb 2010 08:32:53 -0800, Steve Howell wrote: > > The extra expressiveness of Ruby comes from the fact that you can add > > statements within the block, which I find useful sometimes just for > > debugging purposes: > > >     debug = true > >

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-19 Thread Steven D'Aprano
On Fri, 19 Feb 2010 08:32:53 -0800, Steve Howell wrote: > The extra expressiveness of Ruby comes from the fact that you can add > statements within the block, which I find useful sometimes just for > debugging purposes: > > debug = true > data = strange_dataset_from_third_party_code() >

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-19 Thread Steve Howell
On Feb 19, 7:50 am, Roald de Vries wrote: > > This pipeline idea has actually been implemented further, see > blog.onideas.ws/stream.py>. > > > from stream import map, filter, cut > > range(10) >> map(lambda x: [x**2, x**3]) >> filter(lambda t: t[0]! > > =25 and t[1]!=64) >> cut[1] >> list > > [0

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-19 Thread Roald de Vries
This pipeline idea has actually been implemented further, see . from stream import map, filter, cut range(10) >> map(lambda x: [x**2, x**3]) >> filter(lambda t: t[0]! =25 and t[1]!=64) >> cut[1] >> list [0, 1, 8, 27, 216, 343, 512, 729] Wow, cool! Just to show that you can easily add the itera

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-19 Thread Anh Hai Trinh
On Feb 19, 1:44 pm, Steve Howell wrote: > > > def coroutine(co): > >    def _inner(*args, **kwargs): > >        gen = co(*args, **kwargs) > >        gen.next() > >        return gen > >    return _inner > > > def squares_and_cubes(lst, target): > >    for n in lst: > >        target.send((n * n, n

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-18 Thread Steve Howell
On Feb 18, 9:52 pm, Gregory Ewing wrote: > Steve Howell wrote: > > Python may not support the broadest notion of anonymous functions, but > > it definitely has anonymous blocks.  You can write this in Python: > > >     for i in range(10): > >         print i > >         print i * i > >         pri

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-18 Thread Steve Howell
On Feb 18, 9:37 pm, Kurt Smith wrote: > On Thu, Feb 18, 2010 at 10:46 PM, Steve Howell wrote: > > On Feb 18, 2:49 pm, Jonathan Gardner > > wrote: > >> On Feb 18, 8:15 am, Steve Howell wrote: > > >> >     def print_numbers() > >> >         [1, 2, 3, 4, 5, 6].map { |n| > >> >             [n * n,

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-18 Thread Steve Howell
On Feb 18, 9:46 pm, Steven D'Aprano wrote: > On Thu, 18 Feb 2010 19:57:35 -0800, Steve Howell wrote: > > The names you give to the intermediate results here are terse--"tuples" > > and "filtered"--so your code reads nicely. > > > In a more real world example, the intermediate results would be > >

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-18 Thread Steven D'Aprano
On Fri, 19 Feb 2010 18:52:20 +1300, Gregory Ewing wrote: > The Ruby approach has the advantage of making it possible to implement > user-defined control structures without requiring a macro facility. You > can't do that in Python. [...] > Also, most people who advocate adding some form of block-p

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-18 Thread Steve Howell
On Feb 18, 9:41 pm, Steven D'Aprano wrote: > On Thu, 18 Feb 2010 22:48:21 -0500, Steve Holden wrote: > > Next week: Lesson 2 - Ad Hominem Attacks > > I wouldn't pay any attention to Steve, all Stevens are notorious liars. > > -- > Steven Especially when their last name starts with H. Cheers, St

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-18 Thread Steven D'Aprano
On Thu, 18 Feb 2010 19:57:35 -0800, Steve Howell wrote: > The names you give to the intermediate results here are terse--"tuples" > and "filtered"--so your code reads nicely. > > In a more real world example, the intermediate results would be > something like this: > >departments >depart

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-18 Thread Gregory Ewing
Steve Howell wrote: Python may not support the broadest notion of anonymous functions, but it definitely has anonymous blocks. You can write this in Python: for i in range(10): print i print i * i print i * i * i There's a clear difference between this and a Ruby

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-18 Thread Steven D'Aprano
On Thu, 18 Feb 2010 22:48:21 -0500, Steve Holden wrote: > Next week: Lesson 2 - Ad Hominem Attacks I wouldn't pay any attention to Steve, all Stevens are notorious liars. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-18 Thread Paul Rubin
Steve Howell writes: >> http://haskell.org/ghc/docs/6.10.4/html/users_guide/syntax-extns.html... >> might be of interest.  Maybe Ruby and/or Python could grow something similar. > Can you elaborate? List comprehensions are a Python feature you're probably familiar with, and I think Ruby has somet

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-18 Thread Steve Howell
On Feb 18, 7:58 pm, Paul Rubin wrote: > Steve Howell writes: > >> But frankly, although there's no reason that you _have_ to name the > >> content at each step, I find it a lot more readable if you do: > > >> def print_numbers(): > >>     tuples = [(n*n, n*n*n) for n in (1,2,3,4,5,6)] > >>     fi

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-18 Thread Kurt Smith
On Thu, Feb 18, 2010 at 10:46 PM, Steve Howell wrote: > On Feb 18, 2:49 pm, Jonathan Gardner > wrote: >> On Feb 18, 8:15 am, Steve Howell wrote: >> >> >> >> >     def print_numbers() >> >         [1, 2, 3, 4, 5, 6].map { |n| >> >             [n * n, n * n * n] >> >         }.reject { |square, cu

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-18 Thread Steve Howell
On Feb 18, 8:27 pm, "sjdevn...@yahoo.com" wrote: > On Feb 18, 10:58 pm, Paul Rubin wrote: > > Steve Howell writes: > > >> But frankly, although there's no reason that you _have_ to name the > > >> content at each step, I find it a lot more readable if you do: > > > >> def print_numbers(): > > >

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-18 Thread Steve Howell
On Feb 18, 7:58 pm, Paul Rubin wrote: > Steve Howell writes: > >> But frankly, although there's no reason that you _have_ to name the > >> content at each step, I find it a lot more readable if you do: > > >> def print_numbers(): > >>     tuples = [(n*n, n*n*n) for n in (1,2,3,4,5,6)] > >>     fi

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-18 Thread Steve Howell
On Feb 18, 2:49 pm, Jonathan Gardner wrote: > On Feb 18, 8:15 am, Steve Howell wrote: > > > > >     def print_numbers() > >         [1, 2, 3, 4, 5, 6].map { |n| > >             [n * n, n * n * n] > >         }.reject { |square, cube| > >             square == 25 || cube == 64 > >         }.map {

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-18 Thread sjdevn...@yahoo.com
On Feb 18, 10:58 pm, Paul Rubin wrote: > Steve Howell writes: > >> But frankly, although there's no reason that you _have_ to name the > >> content at each step, I find it a lot more readable if you do: > > >> def print_numbers(): > >>     tuples = [(n*n, n*n*n) for n in (1,2,3,4,5,6)] > >>     f

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-18 Thread Paul Rubin
Steve Howell writes: >> But frankly, although there's no reason that you _have_ to name the >> content at each step, I find it a lot more readable if you do: >> >> def print_numbers(): >>     tuples = [(n*n, n*n*n) for n in (1,2,3,4,5,6)] >>     filtered = [ cube for (square, cube) in tuples if s

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-18 Thread Steve Howell
On Feb 18, 3:04 pm, "sjdevn...@yahoo.com" wrote: > On Feb 18, 11:15 am, Steve Howell wrote: > > >     def print_numbers() > >         [1, 2, 3, 4, 5, 6].map { |n| > >             [n * n, n * n * n] > >         }.reject { |square, cube| > >             square == 25 || cube == 64 > >         }.map

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-18 Thread Steve Holden
Steven D'Aprano wrote: > On Thu, 18 Feb 2010 06:15:20 -0800, Steve Howell wrote: [...] > There really ought to be a special level of Hell for people who misuse > "strawman" to mean "a weak or invalid argument" instead of what it > actually means, which is a weak or invalid argument NOT HELD by yo

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-18 Thread Steve Howell
On Feb 18, 3:00 pm, Steven D'Aprano wrote: > [...] > You wouldn't name your functions: > > f01, f02, f03, f04, ... f99 > Exactly. > (say), unless you were trying to deliberately obfuscate your code. > Anonymous functions are even more obfuscated than that. You can get away > with it so long as y

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-18 Thread Jonathan Gardner
On Feb 18, 3:04 pm, "sjdevn...@yahoo.com" wrote: > > You could do it without intermediate names or lambdas in Python as: > def print_numbers(): >     for i in [ cube for (square, cube) in >                          [(n*n, n*n*n) for n in [1,2,3,4,5,6]] >                if square!=25 and cube!=64 ]

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-18 Thread John Bokma
John Bokma writes: > Jonathan Gardner writes: > >> On Feb 18, 8:15 am, Steve Howell wrote: >>> >>>     def print_numbers() >>>         [1, 2, 3, 4, 5, 6].map { |n| >>>             [n * n, n * n * n] >>>         }.reject { |square, cube| >>>             square == 25 || cube == 64 >>>         }.m

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-18 Thread John Bokma
Jonathan Gardner writes: > On Feb 18, 8:15 am, Steve Howell wrote: >> >>     def print_numbers() >>         [1, 2, 3, 4, 5, 6].map { |n| >>             [n * n, n * n * n] >>         }.reject { |square, cube| >>             square == 25 || cube == 64 >>         }.map { |square, cube| >>          

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-18 Thread sjdevn...@yahoo.com
On Feb 18, 11:15 am, Steve Howell wrote: >     def print_numbers() >         [1, 2, 3, 4, 5, 6].map { |n| >             [n * n, n * n * n] >         }.reject { |square, cube| >             square == 25 || cube == 64 >         }.map { |square, cube| >             cube >         }.each { |n| >      

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-18 Thread Steven D'Aprano
On Thu, 18 Feb 2010 08:15:46 -0800, Steve Howell wrote: > Just to be clear, I'm not saying it's unforgivable to occasionally ship > software with bugs. It happens. "Occasionally"? Oh, if only. I would say that there probably isn't a non-trivial application in the world that is entirely bug-fre

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-18 Thread Jonathan Gardner
On Feb 18, 8:15 am, Steve Howell wrote: > >     def print_numbers() >         [1, 2, 3, 4, 5, 6].map { |n| >             [n * n, n * n * n] >         }.reject { |square, cube| >             square == 25 || cube == 64 >         }.map { |square, cube| >             cube >         }.each { |n| >    

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-18 Thread Steven D'Aprano
On Thu, 18 Feb 2010 06:15:20 -0800, Steve Howell wrote: > On Feb 18, 1:23 am, Duncan Booth wrote: >> Jonathan Gardner wrote: >> > On Feb 17, 12:02 am, Lawrence D'Oliveiro > > central.gen.new_zealand> wrote: >> >> In message >> >> <8ca440b2-6094-4b35-80c5-81d000517...@v20g2000prb.googlegroups.com

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-18 Thread Steve Howell
On Feb 18, 7:50 am, Duncan Booth wrote: > Steve Howell wrote: > > If this is an argument against using anonymous functions, then it is a > > quadruple strawman. > > > Shipping buggy code is a bad idea, even with named functions. > > I doubt very much whether I have ever shipped any bug-free code

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-18 Thread Duncan Booth
Steve Howell wrote: > If this is an argument against using anonymous functions, then it is a > quadruple strawman. > > Shipping buggy code is a bad idea, even with named functions. I doubt very much whether I have ever shipped any bug-free code but even if it was fit for purpose when shipped it

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-18 Thread Steve Howell
On Feb 18, 1:23 am, Duncan Booth wrote: > Jonathan Gardner wrote: > > On Feb 17, 12:02 am, Lawrence D'Oliveiro > central.gen.new_zealand> wrote: > >> In message > >> <8ca440b2-6094-4b35-80c5-81d000517...@v20g2000prb.googlegroups.com>, > > >> Jonathan Gardner wrote: > >> > I used to think anonymo

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-18 Thread Duncan Booth
Jonathan Gardner wrote: > On Feb 17, 12:02 am, Lawrence D'Oliveiro central.gen.new_zealand> wrote: >> In message >> <8ca440b2-6094-4b35-80c5-81d000517...@v20g2000prb.googlegroups.com>, >> >> Jonathan Gardner wrote: >> > I used to think anonymous functions (AKA blocks, etc...) would be a >> > nic

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-17 Thread Carl Banks
On Feb 17, 10:39 am, John Bokma wrote: > Jonathan Gardner writes: > > Then I looked at a stack trace from a different programming language > > with lots of anonymous functions. (I believe it was perl.) > > > I became enlightened. > > If it was Perl [1], I doubt it. Because line numbers are report

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-17 Thread Steve Howell
On Feb 16, 4:19 pm, Jonathan Gardner wrote: > On Feb 16, 11:41 am, Andrej Mitrovic > wrote: > > > > > On Feb 16, 7:38 pm, Casey Hawthorne > > wrote: > > > > Interesting talk on Python vs. Ruby and how he would like Python to > > > have ju

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-17 Thread Steve Howell
On Feb 17, 5:39 pm, Steven D'Aprano wrote: > On Wed, 17 Feb 2010 17:04:00 -0800, Jonathan Gardner wrote: > > (What the heck is a procedure, anyway? Is this different from a > > subroutine, a method, or a block?) > > The name is used in Pascal, which probably means it originated from > Fortran or A

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-17 Thread John Bokma
Steven D'Aprano writes: > On Wed, 17 Feb 2010 12:39:30 -0600, John Bokma wrote: [..] >> If it was Perl [1], I doubt it. Because line numbers are reported, and >> if that doesn't help you, you can annotate anonymous functions with a >> nick name using >> >> local *__ANON__ = 'nice name'; > [..

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-17 Thread Steven D'Aprano
On Wed, 17 Feb 2010 17:04:00 -0800, Jonathan Gardner wrote: > (What the heck is a procedure, anyway? Is this different from a > subroutine, a method, or a block?) The name is used in Pascal, which probably means it originated from Fortran or Algol. A subroutine is a generic piece of code which

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-17 Thread Rhodri James
On Thu, 18 Feb 2010 01:04:00 -, Jonathan Gardner wrote: On Feb 17, 12:02 am, Lawrence D'Oliveiro wrote: In message <60b1abce-4381-46ab-91ed- f2ab2154c...@g19g2000yqe.googlegroups.com>, Andrej Mitrovic wrote: > Also, lambda's are expressions, not statements ... Is such a distinction Py

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-17 Thread Steven D'Aprano
On Wed, 17 Feb 2010 12:39:30 -0600, John Bokma wrote: > Jonathan Gardner writes: > >> Then I looked at a stack trace from a different programming language >> with lots of anonymous functions. (I believe it was perl.) >> >> I became enlightened. > > If it was Perl [1], I doubt it. Because line n

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-17 Thread Jonathan Gardner
On Feb 17, 12:02 am, Lawrence D'Oliveiro wrote: > In message <60b1abce-4381-46ab-91ed- > > f2ab2154c...@g19g2000yqe.googlegroups.com>, Andrej Mitrovic wrote: > > Also, lambda's are expressions, not statements ... > > Is such a distinction Pythonic, or not? For example, does Python distinguish > be

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-17 Thread Jonathan Gardner
On Feb 17, 12:02 am, Lawrence D'Oliveiro wrote: > In message > <8ca440b2-6094-4b35-80c5-81d000517...@v20g2000prb.googlegroups.com>, > > Jonathan Gardner wrote: > > I used to think anonymous functions (AKA blocks, etc...) would be a > > nice feature for Python. > > > Then I looked at a stack trace

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-17 Thread Jonathan Gardner
On Feb 17, 10:39 am, John Bokma wrote: > Jonathan Gardner writes: > > Then I looked at a stack trace from a different programming language > > with lots of anonymous functions. (I believe it was perl.) > > > I became enlightened. > > If it was Perl [1], I doubt it. Because line numbers are report

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-17 Thread Steven D'Aprano
On Thu, 18 Feb 2010 11:46:52 +1300, Lawrence D'Oliveiro wrote: > In message , cjw wrote: > >> Aren't lambda forms better described as function? > > Is this a function? > > lambda : None > > What about this? > > lambda : sys.stdout.write("hi there!\n") Of course they are; the first is

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-17 Thread Ben Finney
Lawrence D'Oliveiro writes: > In message , cjw wrote: > > > Aren't lambda forms better described as function? > > Is this a function? > > lambda : None > > What about this? > > lambda : sys.stdout.write("hi there!\n") They are both lambda forms in Python. As a Python expression, they eva

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-17 Thread Terry Reedy
On 2/17/2010 5:46 PM, Lawrence D'Oliveiro wrote: In message, cjw wrote: Aren't lambda forms better described as function? Is this a function? lambda : None What about this? lambda : sys.stdout.write("hi there!\n") To repeat: Python lambda expressions evaluate to function object

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-17 Thread Lawrence D'Oliveiro
In message , cjw wrote: > Aren't lambda forms better described as function? Is this a function? lambda : None What about this? lambda : sys.stdout.write("hi there!\n") -- http://mail.python.org/mailman/listinfo/python-list

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-17 Thread Terry Reedy
On 2/17/2010 1:51 PM, cjw wrote: On 17-Feb-10 05:48 AM, Bruno Desthuilliers wrote: Lawrence D'Oliveiro a écrit : In message <60b1abce-4381-46ab-91ed- f2ab2154c...@g19g2000yqe.googlegroups.com>, Andrej Mitrovic wrote: Also, lambda's are expressions, not statements ... Is such a distinction P

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-17 Thread cjw
On 17-Feb-10 05:48 AM, Bruno Desthuilliers wrote: Lawrence D'Oliveiro a écrit : In message <60b1abce-4381-46ab-91ed- f2ab2154c...@g19g2000yqe.googlegroups.com>, Andrej Mitrovic wrote: Also, lambda's are expressions, not statements ... Is such a distinction Pythonic, or not? Python is (by d

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-17 Thread John Bokma
Jonathan Gardner writes: > Then I looked at a stack trace from a different programming language > with lots of anonymous functions. (I believe it was perl.) > > I became enlightened. If it was Perl [1], I doubt it. Because line numbers are reported, and if that doesn't help you, you can annotate

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-17 Thread Bruno Desthuilliers
Lawrence D'Oliveiro a écrit : In message <60b1abce-4381-46ab-91ed- f2ab2154c...@g19g2000yqe.googlegroups.com>, Andrej Mitrovic wrote: Also, lambda's are expressions, not statements ... Is such a distinction Pythonic, or not? Python is (by design) a statement-based language, so yes, this d

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-17 Thread Bruno Desthuilliers
Aahz a écrit : In article <8ca440b2-6094-4b35-80c5-81d000517...@v20g2000prb.googlegroups.com>, Jonathan Gardner wrote: I used to think anonymous functions (AKA blocks, etc...) would be a nice feature for Python. Then I looked at a stack trace from a different programming language with lots of

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-17 Thread Lawrence D'Oliveiro
In message <8ca440b2-6094-4b35-80c5-81d000517...@v20g2000prb.googlegroups.com>, Jonathan Gardner wrote: > I used to think anonymous functions (AKA blocks, etc...) would be a > nice feature for Python. > > Then I looked at a stack trace from a different programming language > with lots of anonym

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-17 Thread Lawrence D'Oliveiro
In message <60b1abce-4381-46ab-91ed- f2ab2154c...@g19g2000yqe.googlegroups.com>, Andrej Mitrovic wrote: > Also, lambda's are expressions, not statements ... Is such a distinction Pythonic, or not? For example, does Python distinguish between functions and procedures? -- http://mail.python.org/m

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-16 Thread David Cournapeau
On Wed, Feb 17, 2010 at 4:41 AM, Andrej Mitrovic wrote: > > Gary's friend Geoffrey Grosenbach says in his blog post (which Gary > linked to): "Python has no comparable equivalent to Ruby’s do end > block. Python lambdas are limited to one line and can’t contain > statements (for, if, def, etc.). W

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-16 Thread Aahz
In article <8ca440b2-6094-4b35-80c5-81d000517...@v20g2000prb.googlegroups.com>, Jonathan Gardner wrote: > >I used to think anonymous functions (AKA blocks, etc...) would be a >nice feature for Python. > >Then I looked at a stack trace from a different programming language >with lots of anonymous

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-16 Thread Jonathan Gardner
On Feb 16, 11:41 am, Andrej Mitrovic wrote: > On Feb 16, 7:38 pm, Casey Hawthorne > wrote: > > > Interesting talk on Python vs. Ruby and how he would like Python to > > have just a bit more syntactic flexibility. > > >http://blog.extracheese.org/2010/02/pyt

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-16 Thread Andrej Mitrovic
On Feb 16, 7:38 pm, Casey Hawthorne wrote: > Interesting talk on Python vs. Ruby and how he would like Python to > have just a bit more syntactic flexibility. > > http://blog.extracheese.org/2010/02/python-vs-ruby-a-battle-to-the-de... > -- > Regards, > Casey Gary's

Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-16 Thread Casey Hawthorne
Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility. http://blog.extracheese.org/2010/02/python-vs-ruby-a-battle-to-the-death.html -- Regards, Casey -- http://mail.python.org/mailman/listinfo/python-list