Re: Confessions of a Python fanboy

2015-05-11 Thread Steven D'Aprano
On Monday 11 May 2015 11:46, zipher wrote: By having methods like len() in your built-in namespace when it's really only relevant to objects that are types of containers, you blur one primary component of OOP: encapsulation. Gosh, one would almost think that Python's concept of OOP wasn't

Re: Confessions of a Python fanboy

2015-05-11 Thread Mark Lawrence
On 11/05/2015 07:15, Steven D'Aprano wrote: On Monday 11 May 2015 11:46, zipher wrote: By having methods like len() in your built-in namespace when it's really only relevant to objects that are types of containers, you blur one primary component of OOP: encapsulation. Gosh, one would almost

Re: Confessions of a Python fanboy

2015-05-10 Thread zipher
3.) true OOP Now before you go and get all huffy over this statement, hear me out. Python is the best language in the world. But it damn sure has some warts! len(this) instead of obj.length max(that) instead of [1,2,3,4,5].max(). As the Zen says: '[P]racticality beats purity'.

OFFTOPIC, WAS Re: Confessions of a Python fanboy

2015-05-10 Thread zipher
On Sunday, May 10, 2015 at 9:18:55 PM UTC-5, Chris Angelico wrote: On Mon, May 11, 2015 at 12:11 PM, zipher dreamingforw...@gmail.com wrote: Please take care of your quoting. You just quoted two other posts, and I have no idea who said things without going and digging in the archive.

Re: OFFTOPIC, WAS Re: Confessions of a Python fanboy

2015-05-10 Thread Ben Finney
zipher dreamingforw...@gmail.com writes: On Sunday, May 10, 2015 at 9:18:55 PM UTC-5, Chris Angelico wrote: That actually has nothing to do with it. You're still quoting without citation. Well, I replied right at the point of my correspondent (Alex23). That's not the issue :-) The

Re: Confessions of a Python fanboy

2015-05-10 Thread zipher
Please take care of your quoting. You just quoted two other posts, and I have no idea who said things without going and digging in the archive. I'm sorry. I've been sleeping on the beach, away from civilization, a little too long, and didn't see that this was a post from 6 years ago. Feel

Re: Confessions of a Python fanboy

2015-05-10 Thread Chris Angelico
On Mon, May 11, 2015 at 11:46 AM, zipher dreamingforw...@gmail.com wrote: 3.) true OOP Now before you go and get all huffy over this statement, hear me out. Python is the best language in the world. But it damn sure has some warts! len(this) instead of obj.length max(that) instead of

Re: Confessions of a Python fanboy

2015-05-10 Thread Chris Angelico
On Mon, May 11, 2015 at 12:11 PM, zipher dreamingforw...@gmail.com wrote: Please take care of your quoting. You just quoted two other posts, and I have no idea who said things without going and digging in the archive. I'm sorry. I've been sleeping on the beach, away from civilization, a

Re: Confessions of a Python fanboy

2009-08-26 Thread Luis Zarrabeitia
On Friday 31 July 2009 04:08:33 am Masklinn wrote: On 30 Jul 2009, at 23:57 , Luis Zarrabeitia wrote: I'd like to ask, what container.each is, exactly? It looks like a function call (as I've learned a few posts ago), but, what are its arguments? How the looping works? Does it receive a

Re: Confessions of a Python fanboy

2009-08-05 Thread Just Another Victim of the Ambient Morality
Steven D'Aprano ste...@remove.this.cybersource.com.au wrote in message news:pan.2009.08.04.09.28...@remove.this.cybersource.com.au... On Tue, 04 Aug 2009 10:03:53 +0200, Bruno Desthuilliers wrote: Disadvantages: your code is filled with line noise. It's an arbitrary choice between @@ meaning

Re: Confessions of a Python fanboy

2009-08-04 Thread Bruno Desthuilliers
Steven D'Aprano a écrit : On Fri, 31 Jul 2009 13:38:56 +0200, Bruno Desthuilliers wrote: On the other hand, we don't have to prefix names with @ and @@, Nope, we have to prefix them with 'self' or 'cls' (or even 'self.__class__'). Incorrect. Correct for all relevant cases, except this

Re: Confessions of a Python fanboy

2009-08-04 Thread Steven D'Aprano
On Tue, 04 Aug 2009 10:03:53 +0200, Bruno Desthuilliers wrote: Disadvantages: your code is filled with line noise. It's an arbitrary choice between @@ meaning instance attribute and @@ meaning class attribute -- there's no logical reason for choosing one over the other, so you have to

Re: Confessions of a Python fanboy

2009-08-04 Thread Bruno Desthuilliers
Steven D'Aprano a écrit : On Tue, 04 Aug 2009 10:03:53 +0200, Bruno Desthuilliers wrote: Disadvantages: your code is filled with line noise. It's an arbitrary choice between @@ meaning instance attribute and @@ meaning class attribute -- there's no logical reason for choosing one over the

Re: Confessions of a Python fanboy

2009-08-04 Thread Masklinn
On 4 Aug 2009, at 11:28 , Steven D'Aprano wrote: So I'd ask, does Smalltalk's message passing model match the way human beings think? Yes. -- http://mail.python.org/mailman/listinfo/python-list

Re: Confessions of a Python fanboy

2009-07-31 Thread Steven D'Aprano
On Thu, 30 Jul 2009 18:06:31 -0500, Robert Kern wrote: On 2009-07-30 16:44, r wrote: On Jul 30, 4:29 pm, Emmanuel Surleauemmanuel.surl...@gmail.com wrote: 1.) No need to use () to call a function with no arguments. Python -- obj.m2().m3() --ugly Ruby -- obj.m1.m2.m3 -- sweeet! Man, i

Re: Confessions of a Python fanboy

2009-07-31 Thread Masklinn
On 30 Jul 2009, at 23:52 , Jan Kaliszewski wrote: Dnia 30-07-2009 o 22:41:57 Masklinn maskl...@masklinn.net napisał(a): On 30 Jul 2009, at 22:23 , Jan Kaliszewski wrote: 30-07-2009 o 13:36:49 Masklinn maskl...@masklinn.net wrote: On 30 Jul 2009, at 06:04 , alex23 wrote: On Jul 30, 1:06 pm,

Re: Confessions of a Python fanboy

2009-07-31 Thread Masklinn
On 30 Jul 2009, at 23:57 , Luis Zarrabeitia wrote: I'd like to ask, what container.each is, exactly? It looks like a function call (as I've learned a few posts ago), but, what are its arguments? How the looping works? Does it receive a code object that it has to execute? Is .each some kind

Re: Confessions of a Python fanboy

2009-07-31 Thread Steven D'Aprano
On Thu, 30 Jul 2009 18:47:04 +0100, Tim Rowe wrote: That and the fact that I couldn't stop laughing for long enough to learn any more when I read in the Pragmatic Programmer's Guide that Ruby, unlike less flexible languages, lets you alter the value of a constant. Yep, as they say Bug =

Re: Confessions of a Python fanboy

2009-07-31 Thread Xavier Ho
On Fri, Jul 31, 2009 at 6:08 PM, Masklinn maskl...@masklinn.net wrote: snip... but since Python doesn't have anonymous functions that usage tends to be a bit too verbose ... snip Sorry to interrupt, but wouldn't lambda in Python be considered as 'anonymous functions'? --

Re: Confessions of a Python fanboy

2009-07-31 Thread Chris Rebert
On Fri, Jul 31, 2009 at 1:21 AM, Xavier Hocont...@xavierho.com wrote: On Fri, Jul 31, 2009 at 6:08 PM, Masklinn maskl...@masklinn.net wrote: snip... but since Python doesn't have anonymous functions that usage tends to be a bit too verbose ... snip Sorry to interrupt, but wouldn't lambda in

Re: Confessions of a Python fanboy

2009-07-31 Thread Xavier Ho
On Fri, Jul 31, 2009 at 6:25 PM, Chris Rebert c...@rebertia.com wrote: I believe full anonymous functions was intended by the author. lambdas are limited to a single expression. Full anonymous functions would be allowed to contain multiple statements. Cheers, but what about this: def

Re: Confessions of a Python fanboy

2009-07-31 Thread Chris Rebert
On Fri, Jul 31, 2009 at 1:31 AM, Xavier Hocont...@xavierho.com wrote: On Fri, Jul 31, 2009 at 6:25 PM, Chris Rebert c...@rebertia.com wrote: I believe full anonymous functions was intended by the author. lambdas are limited to a single expression. Full anonymous functions would be allowed to

Re: Confessions of a Python fanboy

2009-07-31 Thread Xavier Ho
On Fri, Jul 31, 2009 at 6:38 PM, Chris Rebert c...@rebertia.com wrote: No, because it has a name, namely goBig; this obviously prevents it from being anonymous. For comparison, note how the function in the following example is never given a name, and is thus anonymous: (lambda x: x+5)(6)

Re: Confessions of a Python fanboy

2009-07-31 Thread Jean-Michel Pichavant
r wrote: The purpose of his thread was to get feedback on how Python and Ruby ideas could be cumulated into the best high level language. And being that i am the BDFL of the Confessions of a Python Fanboy thread, you have my personal permission to continue on with this subject matter...,

Re: Confessions of a Python fanboy

2009-07-31 Thread Masklinn
On 31 Jul 2009, at 10:25 , Chris Rebert wrote: On Fri, Jul 31, 2009 at 1:21 AM, Xavier Hocont...@xavierho.com wrote: On Fri, Jul 31, 2009 at 6:08 PM, Masklinn maskl...@masklinn.net wrote: snip... but since Python doesn't have anonymous functions that usage tends to be a bit too verbose

Re: Confessions of a Python fanboy

2009-07-31 Thread Iain King
On Jul 31, 8:28 am, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Thu, 30 Jul 2009 18:06:31 -0500, Robert Kern wrote: On 2009-07-30 16:44, r wrote: On Jul 30, 4:29 pm, Emmanuel Surleauemmanuel.surl...@gmail.com wrote: 1.) No need to use () to call a function with no

Re: Confessions of a Python fanboy

2009-07-31 Thread Masklinn
On 31 Jul 2009, at 11:54 , Iain King wrote: On Jul 31, 8:28 am, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Thu, 30 Jul 2009 18:06:31 -0500, Robert Kern wrote: On 2009-07-30 16:44, r wrote: On Jul 30, 4:29 pm, Emmanuel Surleauemmanuel.surl...@gmail.com wrote: 1.) No need

Re: Confessions of a Python fanboy

2009-07-31 Thread Bruno Desthuilliers
Steven D'Aprano a écrit : On Thu, 30 Jul 2009 18:47:04 +0100, Tim Rowe wrote: That and the fact that I couldn't stop laughing for long enough to learn any more when I read in the Pragmatic Programmer's Guide that Ruby, unlike less flexible languages, lets you alter the value of a constant.

Re: Confessions of a Python fanboy

2009-07-31 Thread Masklinn
On 31 Jul 2009, at 13:38 , Bruno Desthuilliers wrote: Steven D'Aprano a écrit : On Thu, 30 Jul 2009 18:47:04 +0100, Tim Rowe wrote: That and the fact that I couldn't stop laughing for long enough to learn any more when I read in the Pragmatic Programmer's Guide that Ruby, unlike less

Re: Confessions of a Python fanboy

2009-07-31 Thread Bruno Desthuilliers
Masklinn a écrit : On 31 Jul 2009, at 13:38 , Bruno Desthuilliers wrote: Steven D'Aprano a écrit : On Thu, 30 Jul 2009 18:47:04 +0100, Tim Rowe wrote: That and the fact that I couldn't stop laughing for long enough to learn any more when I read in the Pragmatic Programmer's Guide that Ruby,

Re: Confessions of a Python fanboy

2009-07-31 Thread Masklinn
On 31 Jul 2009, at 15:12 , Bruno Desthuilliers wrote: Masklinn a écrit : On 31 Jul 2009, at 13:38 , Bruno Desthuilliers wrote: Steven D'Aprano a écrit : On Thu, 30 Jul 2009 18:47:04 +0100, Tim Rowe wrote: That and the fact that I couldn't stop laughing for long enough to learn any more when

Re: Confessions of a Python fanboy

2009-07-31 Thread Ethan Furman
Steven D'Aprano wrote: On Thu, 30 Jul 2009 18:47:04 +0100, Tim Rowe wrote: That and the fact that I couldn't stop laughing for long enough to learn any more when I read in the Pragmatic Programmer's Guide that Ruby, unlike less flexible languages, lets you alter the value of a constant. Yep,

Re: Confessions of a Python fanboy

2009-07-31 Thread Iain King
On Jul 31, 4:08 pm, Ethan Furman et...@stoneleaf.us wrote: Steven D'Aprano wrote: On Thu, 30 Jul 2009 18:47:04 +0100, Tim Rowe wrote: That and the fact that I couldn't stop laughing for long enough to learn any more when I read in the Pragmatic Programmer's Guide that Ruby, unlike less

Re: Confessions of a Python fanboy

2009-07-31 Thread Benjamin Kaplan
On Fri, Jul 31, 2009 at 11:35 AM, Iain Kingiaink...@gmail.com wrote: On Jul 31, 4:08 pm, Ethan Furman et...@stoneleaf.us wrote: Steven D'Aprano wrote: On Thu, 30 Jul 2009 18:47:04 +0100, Tim Rowe wrote: That and the fact that I couldn't stop laughing for long enough to learn any more when I

Re: Confessions of a Python fanboy

2009-07-31 Thread Steven D'Aprano
On Fri, 31 Jul 2009 13:38:56 +0200, Bruno Desthuilliers wrote: On the other hand, we don't have to prefix names with @ and @@, Nope, we have to prefix them with 'self' or 'cls' (or even 'self.__class__'). Incorrect. class K: ... class_attribute = 'No @@ required.' ...

Re: Confessions of a Python fanboy

2009-07-31 Thread Masklinn
On 31 Jul 2009, at 17:55 , Steven D'Aprano wrote: But seriously, while I admit that I have very little Ruby experience, and so aren't in a great position to judge, it seems to me that Ruby doesn't have anything like Python's over-riding design principles (the Zen). If there is a design

Re: Confessions of a Python fanboy

2009-07-31 Thread Terry Reedy
Masklinn wrote: #each is simply a method that takes a function (called blocks in ruby). One could call it a higher-order method I guess. It's an implementation of the concept of internal iteration: instead of collections yielding iterator objects, and programmers using those through

Re: Confessions of a Python fanboy

2009-07-31 Thread Tim Rowe
2009/7/31 Steven D'Aprano st...@remove-this-cybersource.com.au: On Thu, 30 Jul 2009 18:47:04 +0100, Tim Rowe wrote: That and the fact that I couldn't stop laughing for long enough to learn any more when I read in the Pragmatic Programmer's Guide that Ruby, unlike less flexible languages, lets

Re: Confessions of a Python fanboy

2009-07-31 Thread Falcolas
On Jul 31, 3:49 am, Masklinn maskl...@masklinn.net wrote: On 31 Jul 2009, at 10:25 , Chris Rebert wrote: On Fri, Jul 31, 2009 at 1:21 AM, Xavier Hocont...@xavierho.com   wrote: On Fri, Jul 31, 2009 at 6:08 PM, Masklinn maskl...@masklinn.net   wrote: snip... but since Python doesn't

Re: Confessions of a Python fanboy

2009-07-31 Thread Masklinn
On 31 Jul 2009, at 18:24 , Terry Reedy wrote: Masklinn wrote: #each is simply a method that takes a function (called blocks in ruby). One could call it a higher-order method I guess. It's an implementation of the concept of internal iteration: instead of collections yielding iterator

Re: Confessions of a Python fanboy

2009-07-31 Thread Steven D'Aprano
On Fri, 31 Jul 2009 18:15:15 +0200, Masklinn wrote: I know, I know, Ruby people swear by anonymous code blocks, and I've read Paul Graham too. But I'm really not so sure that the benefits of anonymous code blocks are great enough to overcome the disadvantages of anonymous code blocks.

Re: Confessions of a Python fanboy

2009-07-31 Thread Emmanuel Surleau
On Friday 31 July 2009 18:54:23 Tim Rowe wrote: 2009/7/31 Steven D'Aprano st...@remove-this-cybersource.com.au: On Thu, 30 Jul 2009 18:47:04 +0100, Tim Rowe wrote: That and the fact that I couldn't stop laughing for long enough to learn any more when I read in the Pragmatic Programmer's

Re: Confessions of a Python fanboy

2009-07-31 Thread Masklinn
On 31 Jul 2009, at 20:17 , Steven D'Aprano wrote: On Fri, 31 Jul 2009 18:15:15 +0200, Masklinn wrote: I know, I know, Ruby people swear by anonymous code blocks, and I've read Paul Graham too. But I'm really not so sure that the benefits of anonymous code blocks are great enough to overcome

Re: Confessions of a Python fanboy

2009-07-31 Thread Steven D'Aprano
On Fri, 31 Jul 2009 20:41:12 +0200, Emmanuel Surleau wrote: We don't actually *declare* that something is constant and then have that declaration ignored. Python doesn't lie to us, although (as in any language) a programmer might. You could say that Ruby doesn't either, Well you could say

Re: Confessions of a Python fanboy

2009-07-31 Thread Emmanuel Surleau
On Saturday 01 August 2009 03:46:12 Steven D'Aprano wrote: On Fri, 31 Jul 2009 20:41:12 +0200, Emmanuel Surleau wrote: We don't actually *declare* that something is constant and then have that declaration ignored. Python doesn't lie to us, although (as in any language) a programmer might.

Re: Confessions of a Python fanboy

2009-07-30 Thread Marco Mariani
r wrote: My adventures in Ruby. Oh, it's you. Good boy. Now, why don't you have a look at javascript and come back in six months? Or better yet, haskell and twelve months. thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Confessions of a Python fanboy

2009-07-30 Thread Masklinn
On 30 Jul 2009, at 06:04 , alex23 wrote: On Jul 30, 1:06 pm, r rt8...@gmail.com wrote: 1.) No need to use () to call a function with no arguments. Python -- obj.m2().m3() --ugly Ruby -- obj.m1.m2.m3 -- sweeet! Man, i must admit i really like this, and your code will look so much cleaner.

Re: Confessions of a Python fanboy

2009-07-30 Thread superpollo
Masklinn wrote: ... That's an interesting point, but not relevant at the end of the day: `foo.length` and `length(foo)` have the same practicality. On the other hand Ruby can be praised for the coherence: everything's a method period end of the story; while Python does have a dichotomy

Re: Confessions of a Python fanboy

2009-07-30 Thread Jean-Michel Pichavant
superpollo wrote: Masklinn wrote: ... That's an interesting point, but not relevant at the end of the day: `foo.length` and `length(foo)` have the same practicality. On the other hand Ruby can be praised for the coherence: everything's a method period end of the story; while Python does

Re: Confessions of a Python fanboy

2009-07-30 Thread Masklinn
On 30 Jul 2009, at 14:03 , superpollo wrote: Masklinn wrote: ... That's an interesting point, but not relevant at the end of the day: `foo.length` and `length(foo)` have the same practicality. On the other hand Ruby can be praised for the coherence: everything's a method period end of

Re: Confessions of a Python fanboy

2009-07-30 Thread Colin J. Williams
Some have treated this as a troll. I don't. r wrote: [snip] 1.) No need to use () to call a function with no arguments. Python -- obj.m2().m3() --ugly Ruby -- obj.m1.m2.m3 -- sweeet! Man, i must admit i really like this, and your code will look so much cleaner. +1 2.) the .each method

Re: Confessions of a Python fanboy

2009-07-30 Thread Falcolas
On Jul 29, 9:06 pm, r rt8...@gmail.com wrote: 1.) No need to use () to call a function with no arguments. Python -- obj.m2().m3() --ugly   Ruby -- obj.m1.m2.m3  -- sweeet! Man, i must admit i really like this, and your code will look so much cleaner. I personally would not prefer this, and

Re: Confessions of a Python fanboy

2009-07-30 Thread Inky 788
On Jul 30, 12:04 am, alex23 wuwe...@gmail.com wrote: On Jul 30, 1:06 pm, r rt8...@gmail.com wrote: 1.) No need to use () to call a function with no arguments. Python -- obj.m2().m3() --ugly   Ruby -- obj.m1.m2.m3  -- sweeet! Man, i must admit i really like this, and your code will look

Re: Confessions of a Python fanboy

2009-07-30 Thread r
On Jul 30, 11:31 am, Falcolas garri...@gmail.com wrote: On Jul 29, 9:06 pm, r rt8...@gmail.com wrote: 1.) No need to use () to call a function with no arguments. Python -- obj.m2().m3() --ugly   Ruby -- obj.m1.m2.m3  -- sweeet! Man, i must admit i really like this, and your code will

Re: Confessions of a Python fanboy

2009-07-30 Thread Masklinn
On 30 Jul 2009, at 18:31 , Falcolas wrote: On Jul 29, 9:06 pm, r rt8...@gmail.com wrote: 1.) No need to use () to call a function with no arguments. Python -- obj.m2().m3() --ugly Ruby -- obj.m1.m2.m3 -- sweeet! Man, i must admit i really like this, and your code will look so much cleaner.

Re: Confessions of a Python fanboy

2009-07-30 Thread Masklinn
On 30 Jul 2009, at 19:01 , Inky 788 wrote: On Jul 30, 12:04 am, alex23 wuwe...@gmail.com wrote: On Jul 30, 1:06 pm, r rt8...@gmail.com wrote: 1.) No need to use () to call a function with no arguments. Python -- obj.m2().m3() --ugly Ruby -- obj.m1.m2.m3 -- sweeet! Man, i must admit i

Re: Confessions of a Python fanboy

2009-07-30 Thread r
On Jul 30, 12:15 pm, Masklinn maskl...@masklinn.net wrote: [snip] Furthermore Ruby has a pretty nice convention (sadly not used enough I   think) taken from Scheme where it's possible to postfix a method name   with ! (note: the ! is part of the name, there's no magic) to   indicate that this

Re: Confessions of a Python fanboy

2009-07-30 Thread r
Traceback (most recent post last): File Confessions of a Python Fanboy, lines (13,14), in post vector.reverse -- in-place vector.reversed -- in-place DumbMistakeError: Of course in python you would do... vector.reverse -- in-place vector.reversed -- new vector --

Re: Confessions of a Python fanboy

2009-07-30 Thread Jean-Michel Pichavant
r wrote: On Jul 30, 11:31 am, Falcolas garri...@gmail.com wrote: On Jul 29, 9:06 pm, r rt8...@gmail.com wrote: 1.) No need to use () to call a function with no arguments. Python -- obj.m2().m3() --ugly Ruby -- obj.m1.m2.m3 -- sweeet! Man, i must admit i really like this, and your

Re: Confessions of a Python fanboy

2009-07-30 Thread r
On Jul 30, 12:37 pm, Jean-Michel Pichavant jeanmic...@sequans.com wrote: r wrote: On Jul 30, 11:31 am, Falcolas garri...@gmail.com wrote: On Jul 29, 9:06 pm, r rt8...@gmail.com wrote: 1.) No need to use () to call a function with no arguments. Python -- obj.m2().m3() --ugly   Ruby --

Re: Confessions of a Python fanboy

2009-07-30 Thread Carsten Haese
r wrote: Of course in python you would do... vector.reverse -- in-place vector.reversed -- in-place You do know that only one of those works in-place, right? The above example works pretty good, but this doesn't always sound good. Take for example this... point3d.offset -- return a

Re: Confessions of a Python fanboy

2009-07-30 Thread Tim Rowe
2009/7/30 r rt8...@gmail.com: Like your first lay, your first programing language can leave an indelible mark on you That's true. FOCAL scarred me for life. but i now realize Ruby has some good things going for it. Any language that gets any sort of real use has to have. For instance, I

Re: Confessions of a Python fanboy

2009-07-30 Thread Masklinn
On 30 Jul 2009, at 19:37 , Jean-Michel Pichavant wrote: r wrote: On Jul 30, 11:31 am, Falcolas garri...@gmail.com wrote: On Jul 29, 9:06 pm, r rt8...@gmail.com wrote: 1.) No need to use () to call a function with no arguments. Python -- obj.m2().m3() --ugly Ruby -- obj.m1.m2.m3 --

Re: Confessions of a Python fanboy

2009-07-30 Thread Masklinn
On 30 Jul 2009, at 19:42 , Carsten Haese wrote: r wrote: Of course in python you would do... vector.reverse -- in-place vector.reversed -- in-place You do know that only one of those works in-place, right? Well mostly because the other one doesn't exist (as python has `lst.reverse()` but

Re: Confessions of a Python fanboy

2009-07-30 Thread superpollo
r wrote: On Jul 30, 12:15 pm, Masklinn maskl...@masklinn.net wrote: [snip] Furthermore Ruby has a pretty nice convention (sadly not used enough I think) taken from Scheme where it's possible to postfix a method name with ! (note: the ! is part of the name, there's no magic) to indicate

Re: Confessions of a Python fanboy

2009-07-30 Thread Falcolas
On Jul 30, 11:56 am, Masklinn maskl...@masklinn.net wrote: On 30 Jul 2009, at 19:37 , Jean-Michel Pichavant wrote: r wrote: How do I know if foo.value is an attribute or if it is a method that   returns the foo value ? It cannot be an attribute. Ruby doesn't give access to attributes,  

Re: Confessions of a Python fanboy

2009-07-30 Thread superpollo
Tim Rowe wrote: 2009/7/30 r rt8...@gmail.com: Like your first lay, your first programing language can leave an indelible mark on you That's true. FOCAL scarred me for life. but i now realize Ruby has some good things going for it. Any language that gets any sort of real use has to

Re: Confessions of a Python fanboy

2009-07-30 Thread Masklinn
On 30 Jul 2009, at 20:05 , superpollo wrote: r wrote: On Jul 30, 12:15 pm, Masklinn maskl...@masklinn.net wrote: [snip] Furthermore Ruby has a pretty nice convention (sadly not used enough I think) taken from Scheme where it's possible to postfix a method name with ! (note: the ! is part

Re: Confessions of a Python fanboy

2009-07-30 Thread Masklinn
On 30 Jul 2009, at 20:06 , Falcolas wrote: On Jul 30, 11:56 am, Masklinn maskl...@masklinn.net wrote: On 30 Jul 2009, at 19:37 , Jean-Michel Pichavant wrote: r wrote: How do I know if foo.value is an attribute or if it is a method that returns the foo value ? It cannot be an attribute.

Re: Confessions of a Python fanboy

2009-07-30 Thread superpollo
MRAB wrote: superpollo wrote: ... how to reverse a string in python? must i usa a temp? like: s = ciccio l = list(s) l.reverse() s = .join(l) s 'oiccic' ??? Use slicing with a step of -1: s = ciccio s[::-1] 'oiccic' lol bye --

Re: Confessions of a Python fanboy

2009-07-30 Thread Jan Kaliszewski
30-07-2009 o 13:36:49 Masklinn maskl...@masklinn.net wrote: On 30 Jul 2009, at 06:04 , alex23 wrote: On Jul 30, 1:06 pm, r rt8...@gmail.com wrote: 2.) the .each method container.each{|localVar| block} This method can really cleanup some ugly for loops, although i really like the readability

Re: Confessions of a Python fanboy

2009-07-30 Thread Masklinn
On 30 Jul 2009, at 22:23 , Jan Kaliszewski wrote: 30-07-2009 o 13:36:49 Masklinn maskl...@masklinn.net wrote: On 30 Jul 2009, at 06:04 , alex23 wrote: On Jul 30, 1:06 pm, r rt8...@gmail.com wrote: 2.) the .each method container.each{|localVar| block} This method can really cleanup some ugly

Re: Confessions of a Python fanboy

2009-07-30 Thread Terry Reedy
superpollo wrote: r wrote: how to reverse a string in python? must i usa a temp? like: s = ciccio l = list(s) l.reverse() s = .join(l) s 'oiccic' ??? No. ''.join(list(reversed('abc'))) 'cba' 'abc'[2::-1] 'cba' 'abc'[10::-1] 'cba' Any int = len(string)-1 will do, so

Re: Confessions of a Python fanboy

2009-07-30 Thread r
On Jul 30, 3:55 pm, Terry Reedy tjre...@udel.edu wrote: superpollo wrote: r wrote: how to reverse a string in python? must i usa a temp? like: [snip] Terry Jan Reedy No r never wrote anything like that. reversing a string is RTFM material, this is basic stuff here! Stop quoting me as saying

Re: Confessions of a Python fanboy

2009-07-30 Thread Emmanuel Surleau
1.) No need to use () to call a function with no arguments. Python -- obj.m2().m3() --ugly Ruby -- obj.m1.m2.m3 -- sweeet! Man, i must admit i really like this, and your code will look so much cleaner. It has benefits - code does look better. It has also significant cons - it is

Re: Confessions of a Python fanboy

2009-07-30 Thread Luis Zarrabeitia
On Thursday 30 July 2009 04:41:57 pm Masklinn wrote: On 30 Jul 2009, at 22:23 , Jan Kaliszewski wrote: 30-07-2009 o 13:36:49 Masklinn maskl...@masklinn.net wrote: I don't see any real limitation. What's wrong in: for localVar in container: block Well what's wrong with using that

Re: Confessions of a Python fanboy

2009-07-30 Thread r
On Jul 30, 4:57 pm, Luis Zarrabeitia ky...@uh.cu wrote: [snip] I'd like to ask, what container.each is, exactly? It looks like a function call (as I've learned a few posts ago), but, what are its arguments? How the looping works? Does it receive a code object that it has to execute? Is .each

Re: Confessions of a Python fanboy

2009-07-30 Thread Robert Kern
On 2009-07-30 16:44, r wrote: On Jul 30, 4:29 pm, Emmanuel Surleauemmanuel.surl...@gmail.com wrote: 1.) No need to use () to call a function with no arguments. Python -- obj.m2().m3() --ugly Ruby -- obj.m1.m2.m3 -- sweeet! Man, i must admit i really like this, and your code will look so

Re: Confessions of a Python fanboy

2009-07-30 Thread Tim Rowe
2009/7/30 superpollo u...@example.net: Tim Rowe wrote: Any language that gets any sort of real use has to have. For instance, I love Ada's numeric types (you can specify either the minimum number of significant figures or the maximum delta for a real type, and it will give you a type that

Re: Confessions of a Python fanboy

2009-07-30 Thread Terry Reedy
r wrote: On Jul 30, 3:55 pm, Terry Reedy tjre...@udel.edu wrote: superpollo wrote: r wrote: how to reverse a string in python? must i usa a temp? like: [snip] Terry Jan Reedy No r never wrote anything like that. reversing a string is RTFM material, this is basic stuff here! Stop quoting me

Re: Confessions of a Python fanboy

2009-07-30 Thread I V
On Thu, 30 Jul 2009 17:57:48 -0400, Luis Zarrabeitia wrote: As I understood the question, it was was wrong in 'for var in container' in comparison with ruby's container.each? What's the (semantic) difference between for localVar in container: block and container.each{|localVar|

Re: Confessions of a Python fanboy

2009-07-30 Thread Emmanuel Surleau
On Friday 31 July 2009 01:06:31 Robert Kern wrote: On 2009-07-30 16:44, r wrote: On Jul 30, 4:29 pm, Emmanuel Surleauemmanuel.surl...@gmail.com wrote: 1.) No need to use () to call a function with no arguments. Python -- obj.m2().m3() --ugly Ruby -- obj.m1.m2.m3 -- sweeet!

Re: Confessions of a Python fanboy

2009-07-29 Thread alex23
On Jul 30, 1:06 pm, r rt8...@gmail.com wrote: 1.) No need to use () to call a function with no arguments. Python -- obj.m2().m3() --ugly   Ruby -- obj.m1.m2.m3  -- sweeet! Man, i must admit i really like this, and your code will look so much cleaner. How do you distinguish between calling a

Re: Confessions of a Python fanboy

2009-07-29 Thread Chris Rebert
On Wed, Jul 29, 2009 at 9:04 PM, alex23wuwe...@gmail.com wrote: On Jul 30, 1:06 pm, r rt8...@gmail.com wrote: 1.) No need to use () to call a function with no arguments. Python -- obj.m2().m3() --ugly   Ruby -- obj.m1.m2.m3  -- sweeet! Man, i must admit i really like this, and your code will

Re: Confessions of a Python fanboy

2009-07-29 Thread Carl Banks
On Jul 29, 9:04 pm, alex23 wuwe...@gmail.com wrote: On Jul 30, 1:06 pm, r rt8...@gmail.com wrote: 1.) No need to use () to call a function with no arguments. Python -- obj.m2().m3() --ugly   Ruby -- obj.m1.m2.m3  -- sweeet! Man, i must admit i really like this, and your code will look so