3 ms·
That's a nice sentiment that's completely inaccurate. Even 6 years ago when I first started programming Python, simple Python cgi scripts were very easy to writ
by BrandonM 14y ago
That's a nice sentiment that's completely inaccurate. Even 6 years ago when I first started programming Python, simple Python cgi scripts were very easy to write. It's as simple as:
print """\
Content-type: text/html
<html>...</html>"""
With %(var)s interpolation, you can even slap in locals() easily to trivially put variables' values into the page.
- eli 14y agoThat doesn't seem like it will scale very well at all. Or am I missing something?
- justincormack 14y agoPHP doesn't scale well either. You can rewrite for scaling later.
- gcb 14y agoand you think that manually handling headers is more straightforward than php? I disagree.
- BrandonM 14y ago"Manually handling headers"? That is how people wrote websites in the early 2000s. Many cgi scripts were cobbled together in Perl. I found that I liked Python better. I understand that in PHP you just add some <?php ...> stuff to an otherwise normal HTML file, but the situation in Python, with its multiline strings that support variable interpolation, isn't much worse. Just add the lines I mentioned to the top (treat is as a recipe if you like), and the rest is better than PHP.