Re: Python -Vs- Ruby: A regexp match to the death!

2010-08-16 Thread rantingrick
On Aug 8, 8:15 pm, Steven D'Aprano wrote: > On Sun, 08 Aug 2010 17:43:03 -0700, rantingrick wrote: > > Ruby has what they > > call a "Here Doc". Besides picking the most boneheaded name for such an > > object > > It's standard terminology that has been around for a long time in many > different l

Re: Python -Vs- Ruby: A regexp match to the death!

2010-08-16 Thread rantingrick
On Aug 9, 8:19 am, Mike Kent wrote: > On Aug 8, 8:43 pm, rantingrick wrote: > Xah, this is really you, isn't it.  Come on, confess. *MOI*, How could *I* be xah. I really don't like Ruby however he gushes over it all the time. And he does not like Python that much either. We are total opposites,

Re: Python -Vs- Ruby: A regexp match to the death!

2010-08-09 Thread Robert Kern
On 8/9/10 4:43 PM, Stefan Schwarzer wrote: Hi Robert, On 2010-08-09 22:23, Robert Kern wrote: On 2010-08-09 06:42 , Stefan Schwarzer wrote: Unfortunatey, when I enter In [2]: %paste at the prompt it gives me (before I pasted anything) In [2]: %paste -

Re: Python -Vs- Ruby: A regexp match to the death!

2010-08-09 Thread sturlamolden
On 9 Aug, 10:21, Steven D'Aprano wrote: > And that it's quite finicky about blank lines between methods and inside > functions. Makes it hard to paste code directly into the interpreter. The combination of editor, debugger and interpreter is what I miss most from Matlab. In Matlab we can have a

Re: Python -Vs- Ruby: A regexp match to the death!

2010-08-09 Thread Stefan Schwarzer
On 2010-08-09 23:43, Stefan Schwarzer wrote: > I got that traceback as soon as I typed in "%paste" and > pressed enter, without pasting anything in the terminal. > I had assumed it works like :paste in Vim, activating a I meant ":set paste" of course. Stefan -- http://mail.python.org/mailman/lis

Re: Python -Vs- Ruby: A regexp match to the death!

2010-08-09 Thread Stefan Schwarzer
Hi Robert, On 2010-08-09 22:23, Robert Kern wrote: > On 2010-08-09 06:42 , Stefan Schwarzer wrote: >> Unfortunatey, when I enter >> >>In [2]: %paste >> >> at the prompt it gives me (before I pasted anything) >> >>In [2]: %paste >>

Re: Python -Vs- Ruby: A regexp match to the death!

2010-08-09 Thread Robert Kern
On 2010-08-09 06:42 , Stefan Schwarzer wrote: Hi Steven, On 2010-08-09 10:21, Steven D'Aprano wrote: And that it's quite finicky about blank lines between methods and inside functions. Makes it hard to paste code directly into the interpreter. And that pasting doesn't strip out any leading pro

Re: Python -Vs- Ruby: A regexp match to the death!

2010-08-09 Thread Mike Kent
On Aug 8, 8:43 pm, rantingrick wrote: > Hello folks, > > You all know i been forced to use Ruby and i am not happy about that. ***Blablabla cut long rant*** Xah, this is really you, isn't it. Come on, confess. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python -Vs- Ruby: A regexp match to the death!

2010-08-09 Thread Stefan Schwarzer
Hi Steven, On 2010-08-09 10:21, Steven D'Aprano wrote: > And that it's quite finicky about blank lines between methods and inside > functions. Makes it hard to paste code directly into the interpreter. > > And that pasting doesn't strip out any leading prompts. It needs a good > doctest mode.

Re: Python -Vs- Ruby: A regexp match to the death!

2010-08-09 Thread Steven D'Aprano
On Mon, 09 Aug 2010 00:29:19 -0700, rantingrick wrote: > On Aug 8, 8:15 pm, Steven D'Aprano cybersource.com.au> wrote: > >> In Ruby they decided to be more general, so you can define whatever >> heredoc you need to quote whatever literal string you need. That's not >> bone-headed. > > Devils Ad

Re: Python -Vs- Ruby: A regexp match to the death!

2010-08-09 Thread rantingrick
On Aug 8, 8:15 pm, Steven D'Aprano wrote: > In Ruby they decided to be more general, so you can define whatever > heredoc you need to quote whatever literal string you need. That's not > bone-headed. Devils Advocate! PS: Man you're irb main was so full of cobweb i could barley see the code... h

Re: Python -Vs- Ruby: A regexp match to the death!

2010-08-08 Thread Steven D'Aprano
On Sun, 08 Aug 2010 17:43:03 -0700, rantingrick wrote: > Ha. Ruby does not really have multi line strings. Except, of course, it does, as you go on to show. > Ruby has what they > call a "Here Doc". Besides picking the most boneheaded name for such an > object It's standard terminology that

Re: Python -Vs- Ruby: A regexp match to the death!

2010-08-08 Thread MRAB
rantingrick wrote: Hello folks, [snip] - Strings - Single line strings are exactly the same in both languages except in Ruby double quoted strings are backslash interpreted and single quote strings are basically raw. Except Ruby introduces more cruft (a

Python -Vs- Ruby: A regexp match to the death!

2010-08-08 Thread rantingrick
Hello folks, You all know i been forced to use Ruby and i am not happy about that. But i thought i would share more compelling evidence of the moronicity of the Ruby language syntax from the perspective of regexp's. I recently built myself a nice little Ruby script editor because i hate everythin

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

  1   2   >