Hacker News new | past | comments | ask | show | jobs | submit login

So, Python regexps are suddenly more readable, even though they need additional layer of backslashes?

$_ does not rely on unreadable style. First, it's a common idiom, so it's in no way less comprehensible than list comprehension in Python. You just need to understand what it means. Second, it's not an obligation to use $_. I often avoid it if it doesn't make my code reflecting my intentions better. Funny thing, I do the same in Python, C, and Erlang.

And I hear about $_ and regexp literals as unique selling points (if I read your acronym correctly) only from people that don't really write in Perl.




> So, Python regexps are suddenly more readable, even though they need additional layer of backslashes?

Python encourages a style that makes less use of regexps. (And you don't need extra backslashes, you can use r'...').

> And I hear about $_ and regexp literals as unique selling points (if I read your acronym correctly) only from people that don't really write in Perl.

Nice ad hominem. Go on then - what's your USP for Perl? Why should one use it over Python/Ruby/...?


> Python encourages a style that makes less use of regexps.

Yes, even in the places where regexp would help very much. And even if you'll insist on using regexps, Python makes them highly inefficient or cumbersome (or both), because if you're careful, you'll either get code that needs to store compiled pattern somewhere vaguely related to the code at hand, or code that compiles the pattern on every use. If you are not careful enough, you'll get the two at the same time.

> Nice ad hominem. Go on then - what's your USP for Perl? Why should one use it over Python/Ruby/...?

Thank you, though I wasn't refering to yourself. It was pretty clear you don't write Perl much.

My reason to use it is because it was my primary language for over a decade. For other people? I don't know. All three are similar in what they can do and how does it look afterwards, as all of them are scripting languages in OOP land.

Combine that one and Perl's learning curve, and you'll get why Perl usage was declining over the last decade.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: