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

2010-08-16 Thread rantingrick
On Aug 9, 8:19 am, Mike Kent mrmak...@cox.net wrote: On Aug 8, 8:43 pm, rantingrick rantingr...@gmail.com 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

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

2010-08-16 Thread rantingrick
On Aug 8, 8:15 pm, Steven D'Aprano st...@remove-this- cybersource.com.au 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

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

2010-08-09 Thread rantingrick
On Aug 8, 8:15 pm, Steven D'Aprano st...@remove-this- 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 Advocate! PS: Man you're irb main was so full of

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 st...@remove-this- 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.

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 Mike Kent
On Aug 8, 8:43 pm, rantingrick rantingr...@gmail.com 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 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

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 File

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 --

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

2010-08-09 Thread sturlamolden
On 9 Aug, 10:21, Steven D'Aprano st...@remove-this- cybersource.com.au 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

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

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

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

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 has

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 al...@start.no 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

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 andrej.mitrov...@gmail.com wrote: On Feb 16, 7:38 pm, Casey Hawthorne caseyhhammer_t...@istar.ca 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

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 j...@castleamber.com wrote: Jonathan Gardner jgard...@jonathangardner.net writes: On Fri, Feb 19, 2010 at 11:16 PM, Lie Ryan lie.1...@gmail.com wrote: Now, why don't we start a PEP to make python a fully-functional language then? Because people

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 jgard...@jonathangardner.net 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

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 jgard...@jonathangardner.net writes: On Sun, Feb 21, 2010 at 10:22 AM, John Bokma j...@castleamber.com wrote: Jonathan Gardner jgard...@jonathangardner.net writes: On Fri, Feb 19, 2010 at 11:16 PM, Lie Ryan lie.1...@gmail.com wrote: Now, why don't we start a PEP to make

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 l...@geek-central.gen.new_zealand wrote: In message op.u8at0suda8n...@gnudebst, Rhodri James wrote: In classic Pascal, a procedure was distinct

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 j...@castleamber.com 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

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

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 j...@castleamber.com 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

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 jgard...@jonathangardner.net wrote: On Mon, Feb 22, 2010 at 12:31 PM, John Bokma j...@castleamber.com 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

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 showel...@yahoo.com 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

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 showel...@yahoo.com wrote: On Feb 22, 8:35 pm, Jonathan Gardner jgard...@jonathangardner.net wrote: On Mon, Feb 22, 2010 at 12:31 PM, John Bokma j...@castleamber.com wrote: In my class there where basically 2 groups of people: the ones who got

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 no.em...@nospam.invalid wrote: Steve Howell showel...@yahoo.com 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

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 showel...@yahoo.com 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

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 jgard...@jonathangardner.net writes: On Fri, Feb 19, 2010 at 11:16 PM, Lie Ryan lie.1...@gmail.com 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

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 lie.1...@gmail.com 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 --

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 sjdevn...@yahoo.com wrote: On Feb 20, 1:30 am, Lawrence D'Oliveiro l...@geek- central.gen.new_zealand wrote: If Python doesn’t distinguish between procedures and functions, why should it distinguish between statements and expressions?

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 showel...@yahoo.com 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        

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 spark...@gmail.com wrote: On Feb 18, 4:15 pm, Steve Howell showel...@yahoo.com wrote: ...     def print_numbers()         [1, 2, 3, 4, 5, 6].map { |n|             [n * n, n * n * n]         }.reject { |square, cube|             square == 25 || cube

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 showel...@yahoo.com 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-19 Thread Roald de Vries
This pipeline idea has actually been implemented further, see http:// 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, 1, 8, 27, 216, 343, 512, 729] Wow, cool! Just to show that

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 r...@roalddevries.nl wrote: This pipeline idea has actually been implemented further, see http:// 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]

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, 9:30 am, Steven D'Aprano st...@remove-this- cybersource.com.au 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

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

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 l...@geek-central.gen.new_zealand writes: In message hlhdsi$2p...@theodyn.ncf.ca, cjw wrote: Aren't lambda forms better described as function? Is this a function? lambda : None What about this?

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? --

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 op.u8at0suda8n...@gnudebst, 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

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 l...@geek-central.gen.new_zealand 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 |

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 l...@geek-central.gen.new_zealand 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

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 l...@geek- central.gen.new_zealand wrote: In message 87eikjcuzk@benfinney.id.au, Ben Finney wrote: Lawrence D'Oliveiro l...@geek-central.gen.new_zealand writes: In message hlhdsi$2p...@theodyn.ncf.ca, cjw wrote: Aren't lambda forms better

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 l...@geek- central.gen.new_zealand wrote: In message op.u8at0suda8n...@gnudebst, 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

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 op.u8at0suda8n...@gnudebst, 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

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 l...@geek- central.gen.new_zealand wrote: In message op.u8at0suda8n...@gnudebst, Rhodri James wrote: In classic Pascal, a procedure was distinct from a function in that it had no return value. The concept

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 l...@geek- central.gen.new_zealand wrote: In message op.u8at0suda8n...@gnudebst, 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

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 st...@holdenweb.com wrote: Ben Finney wrote: Lawrence D'Oliveiro l...@geek-central.gen.new_zealand writes: If Python doesn’t distinguish between procedures and functions, why should it distinguish between statements and expressions? I don't see the

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 jgard...@jonathangardner.net wrote: On Feb 17, 12:02 am, Lawrence D'Oliveiro l...@geek- 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,

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 duncan.bo...@invalid.invalid wrote: Jonathan Gardner jgard...@jonathangardner.net wrote: On Feb 17, 12:02 am, Lawrence D'Oliveiro l...@geek- 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 Duncan Booth
Steve Howell showel...@yahoo.com 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

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 duncan.bo...@invalid.invalid wrote: Jonathan Gardner jgard...@jonathangardner.net wrote: On Feb 17, 12:02 am, Lawrence D'Oliveiro l...@geek- central.gen.new_zealand wrote: In message

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 showel...@yahoo.com 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 {

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-free.

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 showel...@yahoo.com 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 {

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 jgard...@jonathangardner.net writes: On Feb 18, 8:15 am, Steve Howell showel...@yahoo.com wrote:     def print_numbers()         [1, 2, 3, 4, 5, 6].map { |n|             [n * n, n * n * n]         }.reject { |square, cube|             square == 25 || 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 j...@castleamber.com writes: Jonathan Gardner jgard...@jonathangardner.net writes: On Feb 18, 8:15 am, Steve Howell showel...@yahoo.com wrote:     def print_numbers()         [1, 2, 3, 4, 5, 6].map { |n|             [n * n, n * n * n]         }.reject { |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 Jonathan Gardner
On Feb 18, 3:04 pm, sjdevn...@yahoo.com 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

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 st...@remove-this- cybersource.com.au 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

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 your

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 sjdevn...@yahoo.com wrote: On Feb 18, 11:15 am, Steve Howell showel...@yahoo.com wrote:     def print_numbers()         [1, 2, 3, 4, 5, 6].map { |n|             [n * n, n * n * n]         }.reject { |square, cube|             square == 25 || 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 Paul Rubin
Steve Howell showel...@yahoo.com 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

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 no.em...@nospam.invalid wrote: Steve Howell showel...@yahoo.com 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

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 jgard...@jonathangardner.net wrote: On Feb 18, 8:15 am, Steve Howell showel...@yahoo.com wrote:     def print_numbers()         [1, 2, 3, 4, 5, 6].map { |n|             [n * n, n * n * n]         }.reject { |square, cube|             square == 25

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 no.em...@nospam.invalid wrote: Steve Howell showel...@yahoo.com 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

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 sjdevn...@yahoo.com wrote: On Feb 18, 10:58 pm, Paul Rubin no.em...@nospam.invalid wrote: Steve Howell showel...@yahoo.com writes: But frankly, although there's no reason that you _have_ to name the content at each step, I find it a lot more

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 showel...@yahoo.com wrote: On Feb 18, 2:49 pm, Jonathan Gardner jgard...@jonathangardner.net wrote: On Feb 18, 8:15 am, Steve Howell showel...@yahoo.com wrote:     def print_numbers()         [1, 2, 3, 4, 5, 6].map { |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, 7:58 pm, Paul Rubin no.em...@nospam.invalid wrote: Steve Howell showel...@yahoo.com 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

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 showel...@yahoo.com 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

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 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 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

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 st...@remove-this- cybersource.com.au 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

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

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 st...@remove-this- cybersource.com.au 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

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 kwmsm...@gmail.com wrote: On Thu, Feb 18, 2010 at 10:46 PM, Steve Howell showel...@yahoo.com wrote: On Feb 18, 2:49 pm, Jonathan Gardner jgard...@jonathangardner.net wrote: On Feb 18, 8:15 am, Steve Howell showel...@yahoo.com wrote:     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, 9:52 pm, Gregory Ewing greg.ew...@canterbury.ac.nz 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

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? --

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 anonymous

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 jgard...@jonathangardner.net 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

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 jgard...@jonathangardner.net 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

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

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

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 hlhdsi$2p...@theodyn.ncf.ca, 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 5:46 PM, Lawrence D'Oliveiro wrote: In messagehlhdsi$2p...@theodyn.ncf.ca, 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

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 l...@geek-central.gen.new_zealand writes: In message hlhdsi$2p...@theodyn.ncf.ca, 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

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 hlhdsi$2p...@theodyn.ncf.ca, 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

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 j...@castleamber.com wrote: Jonathan Gardner jgard...@jonathangardner.net 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

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 l...@geek- 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 nice feature for Python. Then I

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 l...@geek- central.gen.new_zealand 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,

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 jgard...@jonathangardner.net 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

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 jgard...@jonathangardner.net wrote: On Feb 17, 12:02 am, Lawrence D'Oliveiro l...@geek- central.gen.new_zealand wrote: In message 60b1abce-4381-46ab-91ed- f2ab2154c...@g19g2000yqe.googlegroups.com, Andrej Mitrovic wrote: Also, lambda's

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 John Bokma
Steven D'Aprano ste...@remove.this.cybersource.com.au 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

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 ste...@remove.this.cybersource.com.au 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

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 jgard...@jonathangardner.net wrote: On Feb 16, 11:41 am, Andrej Mitrovic andrej.mitrov...@gmail.com wrote: On Feb 16, 7:38 pm, Casey Hawthorne caseyhhammer_t...@istar.ca wrote: Interesting talk on Python vs. Ruby and how he would like Python

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 j...@castleamber.com wrote: Jonathan Gardner jgard...@jonathangardner.net 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

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

  1   2   >