Hacker News new | ask | show | jobs
by jeffisabelle 4920 days ago
cool job right there, but just curious, why this is php >> python and not php << >> phython ? does that need a lot more work?
1 comments

Because mostly everyone hates PHP. This site serves to show the Python way of doing things if anyone's interested, or is moving away from PHP.

Edit: I am wrong, not everyone hates PHP.

"Everyone hates PHP"? Really?

It might not be the most popular language around the HN crowd, but this forum is subject to trends and "emerging technologies" - not necessarily to say that these technologies are better or worse, just that they are the flavor of the month.

It's hard to argue with the numbers, PHP is still the most popularly used language [1] and while the gap is being bridged, it is really minuscule in comparison. I'm sure that while you may hate PHP, not every single developer does.

Yes, yes, down vote me, I'm a proud PHP developer and to even utter such words on this site seems to result in the most powerful of criticisms, but subjective to this entire argument is that behind every person who writes PHP is a ruby coder, tutting and shaking his head, stood behind him is a Node.js developer, laughing at him, behind him is somebody writing Assembly, scowling in to the distance in disgust, behind him is a C coder, eyes wide with surprise that someone is working in Assembly, etc.

I give it a few years until people are crying out loud on here that Node.js is dead and superlanguageemulator.pm or whatever comes next is the only way to code, at least, for people wise and intelligent enough to embrace this new technology.

[1] http://w3techs.com/technologies/overview/programming_languag...

That link isn't really credible at all. There are two obvious and major omissions that render their chart meaningless.

They don't say how they determine whether a technology is being used server side -- it could be only if they see ".php" URLs on the site, for example, which would mean there would be a strong bias against languages that make it easy to write sane URLs.

They also don't share what % of sites they're able to make a determination for at all, so these numbers could be based on a statistically insignificant sample.

You only have to go on the job market to see what languages are the most popular; PHP, JAVA and the various .Net (Mostly VB and C#).

JS is on the rise, but no one hires anyone to write just JS. It's usually JS and PHP (and of course, HTML, CSS).

And another point, outside the bubble (I mean a place like Florida) it's hella easier finding a decent PHP guy than Python (or Ruby) guy. I learned that the hard way.

From what I can see, in my area (north England) the job market is almost entirely dominated by PHP and .net openings, with some Java on the side. Ruby and Python only very rarely get a look in, I imagine it would actually be difficult to find work in this area if you only knew Ruby or Python.

The job market in CA is very different to pretty much everywhere else in that emerging and niche technologies tend to be under-represented outside of CA, most likely because of budget constraints in web development, most clients want a simple Joomla or WordPress site and couldn't care less about anything else as long as they don't have to pay over £2,000 for it.

Re: the first para, definitely. I still get emails from recruiters (probably left something up on an old CV site I've since forgotten about), and every single one up north involves PHP and MySQL. The more imaginative roles include a bit of jQuery.

I've never received offers for anything else.

>> but no one hires anyone to write just JS.

You are joking. Right?

There are many good job opportunities for JS developers. I don't know where you got the idea otherwise.

FWIW, I was hired to do just JS.

I got the idea from hiring. Look at what was being advertised for; what I was competing against.. But I live in Florida. What area of the country are you?
By default PHP includes an X-Powered-By header in the response containing the PHP version used (should be turned off in production but is often not). This is a more common thing to track.
> which would mean there would be a strong bias against languages that make it easy to write sane URLs

This is false. It is very easy to make sane URLs in PHP. You just designate index.php (or whatever you want, actually) as the default index in your http server. In fact, that's how it works in every language?

Did you just compare node.js to assembly? :)
Clearly not, it was a satire of our industry. I was comparing the attitudes of people, the languages they use were merely for the purpose of the narrative, it could quite easily have been Node.js and Perl or Python and Haskell
As someone who doesn't know much in the way of Python, it seems odd to me that many of the examples are blocks of code vs one line replacements for PHP functions. Is Python just more verbose?
I know both languages well. Python is much more succinct than PHP because of array literals, list comprehensions, lambda's and better native data types with ways to navigate them (all the functional methods are there). Only PHP 5.4 with a literal array syntax is beginning to approach some of the things you can do in Python.

You think PHP is short because you have functions like xmlrpc_encode_request and the equivalent in Python is 20 lines. What you don't see if that xmlrpc_encode_request is pages and pages of C code and PHP macro's behind the scenes. That function should be in a library, not in a programming language, which is why PHP is more comparable to other web frameworks, not to other programming languages.

It IS a PHP library - just one written in C rather than in user-land PHP code. Why is this a problem? The XML-RPC extension isn't even enabled by default.
xmlrpc_encode_request on this site should probably be fixed to use xmlrpclib.dumps (or loads if you need the other direction). This has existed in Python since version 2.2.

I realize this is beside the point, but I'm willing to fix it myself.

There is xmlrpclib inlcuded per default and it does all the XML stuff, so i think you can easily get away far more readable then what is shown in the python reimplementation of the PHP function. http://docs.python.org/2/library/xmlrpclib.html#example-of-c...

It just doesn't have xmlrpc_encode_request() with the exact method signature.

P.S.: I am wondering if it is normal to have functions marked as EXPERIMENTAL with a biiiig warning sign for 11 years in the language? That really scares me. This function has been introduced in PHP 4.1.0 which was releases in 10-Dec-2001... That's just...

edit: removed rant about xmlrpc_encode_request being built-in. It's a non-default extension, apparently..

No it's not.

The reason the examples appear longer is because the website is documenting how to implement PHP functions in Python. Since Python is not PHP, it won't implement line-for-line replacement functions.

No, just PHP has a tradition of implementing frequently used code in C. This means PHP has tons of functions that serve specific use case, while Python has less of them, at least in standard package (of course you can have a module that does the same and then you'd have one-liners too). So you're not comparing the same thing here.
Using both PHP5 in the past and Python more recently, I find that most things in Python need far less code to write than PHP.

The examples here are kind of disingenuous to that, but if you start writing code that takes advantage of the features of Python, your lines of code should be less than PHP or equal.

I don't think it's complete. For example this: http://www.php2python.com/wiki/function.array-walk/ could be replaced with map() in Python.
No, there are a lot of shortcuts and beautiful one-liners in Python. However, Pythonic code always focuses on being the simplest and cleanest as opposed to being the shortest. I suspect it's the author's way of imposing some good python coding standards at the same time.
I wish everyone hated PHP. Then one one would write it.
I agree that "hate php and love python" part, however, we may still need to use php or at least read php code at work/school. and this app could be useful for that purpose if it had python to php conversion too.
I am using Python since 6 months after working with PHP for many years. Guess what? I don't hate PHP.
I don't hate PHP, so you are wrong.