Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Crush the python!
Index -> Off Topic
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Insectoid




PostPosted: Tue Jun 16, 2009 12:14 pm   Post subject: Crush the python!

Posted Image, might have been reduced in size. Click Image to view fullscreen.
Sponsor
Sponsor
Sponsor
sponsor
BigBear




PostPosted: Tue Jun 16, 2009 4:50 pm   Post subject: Re: Crush the python!

But Python received the Linux New Media Award in the category Best Open Source Programming Language.
Source
DtY




PostPosted: Tue Jun 16, 2009 6:27 pm   Post subject: Re: Crush the python!

BigBear @ Tue Jun 16, 2009 4:50 pm wrote:
But Python received the Linux New Media Award in the category Best Open Source Programming Language.
Source

Don't forget that python comes with libraries to do anything you could possibly ever want to do.

(Except pygame)
Shah-Cuber




PostPosted: Tue Jun 16, 2009 6:31 pm   Post subject: Re: Crush the python!

As a python programmer (mainly), I strongly disagree with this ...
Python FTW!
Insectoid




PostPosted: Tue Jun 16, 2009 7:14 pm   Post subject: RE:Crush the python!

Lol, I saw this while looking up that picture of uncle sam pointing at the reader. Just had to share it. Plus, I use Ruby, so while I don't think python sucks, python sucks compared to ruby.
DtY




PostPosted: Wed Jun 17, 2009 11:34 am   Post subject: Re: RE:Crush the python!

insectoid @ Tue Jun 16, 2009 7:14 pm wrote:
Lol, I saw this while looking up that picture of uncle sam pointing at the reader. Just had to share it. Plus, I use Ruby, so while I don't think python sucks, python sucks compared to ruby.

Ruby does have much nicer syntax. I think the only reason Ruby is a better language is that you can attach new methods to pre-existing classes. If python had that, I think I would have no reason to continue using Ruby.

[edit] And the method names, like:
Ruby:
class Something
def *(other)
self * other
end
end

Is much nicer looking than:
Python:
class Something:
    def __mul__(a,b):
        return a*b
Alexmula




PostPosted: Wed Jun 17, 2009 2:08 pm   Post subject: Re: Crush the python!

leave python alone ! Evil or Very Mad Laughing
andrew.




PostPosted: Wed Jun 17, 2009 4:12 pm   Post subject: RE:Crush the python!

I don't have much experience with Ruby, but I think that Python is a great language in general.
Sponsor
Sponsor
Sponsor
sponsor
Dan




PostPosted: Wed Jun 17, 2009 4:30 pm   Post subject: Re: RE:Crush the python!

DtY @ 17th June 2009, 11:34 am wrote:
I think the only reason Ruby is a better language is that you can attach new methods to pre-existing classes. If python had that, I think I would have no reason to continue using Ruby.


Dos'nt every OOP langue have that threw inheritence? (Make a child class with the new method).

If you mean dynamically then thats posible too:

Python:

class foo:
   pass
   
bar = foo()

def new_method(self):
   print "Hello World"
   
foo.method = new_method

bar.method()
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
rdrake




PostPosted: Wed Jun 17, 2009 4:55 pm   Post subject: RE:Crush the python!

I think he means that you can attach and even replace methods from existing classes without needing inheritance.

Hell, you can add methods to even sealed classes in C# if you wanted to.
DtY




PostPosted: Wed Jun 17, 2009 4:55 pm   Post subject: RE:Crush the python!

Oh wow, I never thought of that. That's awesome!
It doesn't seem to work for builtin types though, which is a shame.

Python:
>>> def inc(self):
...     self+=1
...
>>> int
<type 'int'>
>>> int.inc = inc
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: can't set attributes of built-in/extension type 'int'
rizzix




PostPosted: Wed Jun 17, 2009 6:58 pm   Post subject: Re: RE:Crush the python!

rdrake @ Wed Jun 17, 2009 4:55 pm wrote:
I think he means that you can attach and even replace methods from existing classes without needing inheritance.

Hell, you can add methods to even sealed classes in C# if you wanted to.


A seemingly powerful but dangerous feature, since you've changed the semantics of a class without formally declaring to do so. But then again, Ruby is not strictly typed.
rdrake




PostPosted: Wed Jun 17, 2009 10:15 pm   Post subject: RE:Crush the python!

You can do funny things.

Ruby:
rdrake@HEXLEY:~$ irb
irb(main):001:0> class Fixnum
irb(main):002:1>   def to_s
irb(main):003:2>     "42"
irb(main):004:2>   end
irb(main):005:1> end
=> nil
irb(main):006:42>
Zeroth




PostPosted: Sat Jun 20, 2009 11:16 am   Post subject: Re: Crush the python!

Actually, thats only CPython for which that is true. Its not part of the python specification. Its only true for a specific interpreter.
code:

Jython 2.2.1 on java1.6.0_0
Type "copyright", "credits" or "license" for more information.
>>> dict
<type 'dict'>
>>> dict.test = lambda x: '42'
>>> dict.test()
Traceback (innermost last):
  File "<console>", line 1, in ?
TypeError: unbound method <lambda>() must be called with dict instance as first argument (got nothing instead)
>>> d=dict()
>>> d.test
<method dict.<lambda> of dict instance 1>
>>> d.test()
'42'
>>>


Now, as to the special method names, Python has a philosophy of using as few non-alphanumeric symbols as possible, where logical. They only use symbols for math, periods, commas, colons, semi-colons, brackets, etc. Besides, how would you differentiate in Ruby the difference between right multiplication, left multiplication, and normal multiplication? Python lets you define all three, where the left and right versions of multiply deal with situations where the other object doesn't have a multiply overload.
DtY




PostPosted: Sat Jun 20, 2009 11:51 am   Post subject: RE:Crush the python!

Isn't CPython the python specification? Writing a python script that wont work in CPython is useless.
Display posts from previous:   
   Index -> Off Topic
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 2  [ 25 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: