News for hackers. Stuff that matters.
Re:PHP Addiction by lucian1900 on Friday June 29, 2012 @02:16PM (#4178146)
While I find Ruby to be nice overall, you're wrong on several points:

- Whether or not Python was historically OO or not, everything in Python is now an object. Its love for protocols drives design like `str(foo)` (which calls `foo.__str__()`), not any particular deficiency in its object system

- Python's lambdas are indeed limited, but one can easily use `def` and just name the function. Functions are first class, after all

- Metaprogramming facilities are very similar in power. Neither language has macros.

- Python tends insist on not duplicating things (i.e. both indentation and braces/end) and on not being ambiguous. There is another reason Python can't omit braces for function calls: without braces, they are references to the function. As a consequence, Python doesn't need things like .call()

Overall, I haven't seen one language or the other to be more powerful.

Re:PHP Addiction by wilmoore on Saturday June 30, 2012 @04:19AM (#4181094)
Personally, I find that Python and Ruby are comparable as it relates to utility. I'd think it is fair to say that argument is a wash. It is Ruby's expressiveness that makes it my choice before Python:

--- Ruby ---

  letters = ['a', 'b', 'c']
  letters.map &:capitalize
--- Python ---

  letters = ['a', 'b', 'c']
  capitalize = lambda x: x.capitalize()
  map(capitalize, letters)
--- PHP ---

  <?php
  $letters = ['a', 'b', 'c'];
  array_map('strtoupper', $letters);
Of course, this is one example where PHP (5.4+) at least somewhat resembles Python. I think that is why some of the more experienced PHP developers tend to choose to go with Python as their PHP recovery language.

Personally, I prefer "letters.map" (Ruby) over "map(...)" and "array_map(...)"; however, that is a personal style preference and has nothing to do with technical merit. And I still enjoy writing Python here and there. PHP is also still a necessity much of the time.

That being said, there are a few edge cases that I've witnessed where Python actually reads better than Ruby; though, these cases are few.

Re:PHP Addiction by kami8845 on Sunday July 01, 2012 @01:52AM (#4183973)
idiomatic python would be

    chars = 'abc'
    [c.upper() for c in chars]
Re:PHP Addiction by wilmoore on Monday July 09, 2012 @04:24PM (#4220201)
Fair enough :)