Comparison with Ruby ?
Alex Martelli
aleaxit at yahoo.com
Thu Feb 22 04:19:34 EST 2001
More information about the Python-list mailing list
Thu Feb 22 04:19:34 EST 2001
- Previous message (by thread): Specifying links in Python-URL bulletin
- Next message (by thread): Comparison with Ruby ?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Juergen Bocklage" <juergen.bocklage at gmx.net> wrote in message news:3A94489D.5B65ED19 at gmx.net... > Aehmmm, I'm just a beginner, but some remarks on the ruby-python > comparision. [snip] > Python separates types and classes, while Ruby treats them the > same. Python types are more limited (no > inheritance/subclassing; cannot add methods to existing types). > JB> Don't know A Ruby win here. > Ruby has a better (or "real") closure feature. > JB> what does this mean Nothing, actually. Some people are SO keen on nested lexical scopes, that they'll (mistakenly) argue that a closure is not one unless it supports _nested_ lexical scopes. Until 2.0, Python's scopes don't nest, so, of course, they keep not nesting in closures; at 2.1, they will (alas) nest, so, of course, they'll keep nesting in closures. > Ruby converts small integers and long integers automatically. > JB> Okay, nice for you No way. Explicit is better than implicit. I'd rather NOT have such 'automatic' (automagick) conversions anywhere! > Ruby does not have tuples. > JB> Bad for Ruby. They are fast. Disagree. 'Fast' should be handled by the compiler and runtime. Tuples should be lists with an "immutable" setting (and there should be similar "immutable" settings for dictionaries) but otherwise indistinguishable. > def +(x) > self.to_i + x > end > > JB> I know this from C++, (Syntactical sugar or a good source for > errors) It's not more error-prone than using __add__ as the magic name for overloading addition, which is why Python does. Looks like a total wash to me. > Ruby has a loop abstraction using block; e.g. > > 10.times do > ... > end > > JB> What's this? A method 'times' on integer objects, that takes a code-block. > You can define your own arbitrary iterator. > JB> Why? To iterate arbitrarily. Why else? > Ruby provides method combination using `super'. > JB> this is a good feature, in python I think you have to use the name > of parent class. Disagree -- I _like_ it that the SPECIFIC parent-class you mean has to be explicitly mentioned (multiple-inheritance, remember). I don't like the complex rules of Dylan to allow magick implicitness in this, nor constraining inheritance to single just to allow 'super' to work:-). > Python is for me the language for beginners and designers. Not just for them. Lots of Hackers and eXtreme Programmers are also pretty happy with it. Alex
- Previous message (by thread): Specifying links in Python-URL bulletin
- Next message (by thread): Comparison with Ruby ?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list