> I am a Rubyist, but I've decided to learn Python Welcome, could be interesting. I'm a pythonista and have learned Ruby but not used it for anything significant yet.
> At any rate, so far Python seems to be a very good > language. Not a great language, but still very good. There is only one great language: Lisp :-) > So far, some things I dont care for... > immutable strings > no case statement Yes, most folks find those concepts pretty strange. Personally I don't miss case statements (see a recent thread) I usually find Pythons stricture means I rethink the design and usually manage to avoid the need (and potential bugs that are inherent in case structures...) but mutable strings would be nice, although potentially dangerous for dictionary keys. > lack of internal iterators NOt sure what you mean by this one, can you expand? > The mixing of functions and methods You mean the fact that Python doesn't insist on everything being an object? That simply reflects that Python can be used in several difreent paradigms. Functional Programming is the biggest "modern" alternative to OOP and support for functions as first class objects supports that style. Ruby can fake it with its top level "invisible" object, but Python just makes that style a natural part of the language. OTOH if you mean the inconsistencies in the use of methods versus functions in the base language (eg files have a close method but an open function) then I agree and Python is slowly removing those with each release. The biggest step being the introduction of strings as objects/methods and another step forward being the new-style classes in v2.x This is one area where Matz learned lessons from Perl/Python when he invented Ruby - the advantage of going second (or third or fourth...) > Question(s): > Are there any good books/documents that actually > examine the ruby way vs python way? (by someone that > knows both languages) NOt that I know of. > The other day I saw a post from a gentleman trying to > do a basic prompt and add type of calculator. > He wanted to assign the +, or * operator to a variable > to use, but I believe he was told you have to use the > literal +, or *. Thats possible using the operator module. > Are these operators constanst in Python? Not really, in that you can override them (__add__, __Sub__, __mul__ etc) and the operator module gives access to the common ones in a generic kind of way. > If so, is there not a way to send that constant to > act apon another variable or variables that refer to > numbers? I didn't see the post but it sounds as if the poster should have been able to do what [s]he wanted. > In ruby, you can rerence the * operator > operator = :* > num1 = 4 > num2 = 6 > num1.send(operator,num2) In Python: import operator num1 = 4 num2 = 6 operator.mul(num1,num2) Alan G. > which returns 24 > > Have a nice day :-) > > > > > __________________________________ > Do you Yahoo!? > Yahoo! Mail - now with 250MB free storage. Learn more. > http://info.mail.yahoo.com/mail_250 > > _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor