News for hackers. Stuff that matters.
Re:Perl 6 Optimism by vgy7ujm on Tuesday January 23, 2018 @08:51AM (#16213507)
Special characters, clear visual markers of scope etc. that Python lacks is part of the appeal of Perl to me.

I feel like a dyslectic when I read Python (projects of significant size) due to it being much less visually helpful and that the idea of simplicity falls apart when the problems are not trivial and when multiple devs have touched the code over multiple years.

YMMV of course but that is why your POV is not objective and I disagree.

Re:Perl 6 Optimism by toyg on Tuesday January 23, 2018 @09:33AM (#16213783)
The visual marker of scope is there and it's massive: indentation.

You can write bad code in every syntax, but when a language carries jokes about being "write-only" and the other has a reputation for being anal about indentation (the single most helpful scope-marker in any syntax), I don't think you can argue about objectivity when discussing readability.

This said, I'd like to see scientific comparisons, which are lacking. Some studies suggest terse languages using more special characters are more readable to experienced programmers than ones with simpler syntax, which seems to match your experience. That might well be true; but when applied to the real world, this still means than only a minority will ever prefer that style over a simpler one. As the number of coders naturally rises, this will only become more and more true over time.

Re:Perl 6 Optimism by newen on Tuesday January 23, 2018 @10:22AM (#16214231)
Bro, literally every language does indentation. Python just does indentation badly by making it syntactically significant.

Also. If you're going to come back to me with the argument that it forces people to use indentation, I've got some news for you. Literally everyone uses indentation. And if you somehow come across code written by the rare soul that doesn't use indentation, all I've to do is select the entire code and click "re-indent". Which, btw, in python is a chore to fix badly indented code with tabs and spaces mixed in together. And it's even more work to properly copy-paste python code, even in good editors.

Re:Perl 6 Optimism by mixmastamyk on Tuesday January 23, 2018 @11:38AM (#16214872)
> everyone uses indentation.

Yes, if you don’t you’re incompetent. If you do, the markers are then redundant.

Mixed indentation hasn’t been allowed in years.

Any good editor will show mixed indentation, guides, and indent properly with the tab key, get one.

Sounds like your knowledge of Python is about a decade behind. Not to mention those were nonissues from my experience even back in the day.

Re:Perl 6 Optimism by newen on Tuesday January 23, 2018 @04:59PM (#16218169)
These issues are only there because python has significant whitespace. These issues should not have been there in the first place.

Ideally, I shouldn't need to use an editor geared specifically for python code to copy-paste some python code and run it. I have had no issues with the majority of other languages when copy-pasting some code and reindenting. Only in python have I had issues with it. Even in elpy-mode in Emacs, I have had issues. Another is Jupyter/IPython, a widely used python IDE for data scientists, where this problem crops up all the time. So lay off with the superior attitude.

Re:Perl 6 Optimism by mixmastamyk on Tuesday January 23, 2018 @10:29PM (#16220086)
Don’t need a special editor, just an industry-standard one, that’s the whole point.

I was bothered by the whitespace too, for an hour one afternoon in the spring of ~2001. Then I got over it and realized what a masterstroke it was, removing ~15% of the redundant visual noise.

Firstly, if you cut and paste so often that you feel it should take precedence over everyday readability and conciseness, then that’s a dev smell. Code is read 10x as much as written, likely one reason perl declined.

Secondly, you could simply toggle view whitespace on your editor or have it replace the indent chars on the tab key. Geany does this automatically via pref and it’s Python-specific support is basic.

Thirdly, Python3 and pep8 make issues even less likely than they were. Which is approximately never in my experience in the last ten years or so.

So, this subthread could have been on slashdot in ‘98, hence the frustration.

It’s such a fucking non-issue and productivity boon. Like using yaml for config instead of json.

Re:Perl 6 Optimism by newen on Tuesday January 23, 2018 @11:22PM (#16220295)
My point is that you should be able to code python using Notepad but it is impossible to. Yeah, when multiple people complain of the same thing and you make up more and more complicated solutions for the problem, then you know where the problem lies. Also, you smell.
Re:Perl 6 Optimism by mixmastamyk on Wednesday January 24, 2018 @10:37AM (#16223446)
Yeah, using an editor is so complicated. Maybe programming isn’t for you.
Re:Perl 6 Optimism by newen on Wednesday January 24, 2018 @03:30PM (#16226022)
There are many cases where it is. And your rudeness and devolution into pathetic statements like this is noted.
Re:Perl 6 Optimism by emmelaich on Tuesday January 23, 2018 @10:24PM (#16220067)
When I started writing C a million years ago I thought to myself -- why the f$# does the compiler need to be told twice what the structure of my code is? Once with {} and once with indentation. It's not as if anyone half-sensible is going to write good code with bad indentation.

With that thought in mind, I am pathetically grateful for Python.

Re:Perl 6 Optimism by ptman on Wednesday January 24, 2018 @05:02AM (#16221574)
the compiler doesn't care about indentation, look at IOCCC https://www.ioccc.org
Re:Perl 6 Optimism by emmelaich on Wednesday January 24, 2018 @07:00AM (#16222039)
I know. I'm saying it should. Because why not?
Re:Perl 6 Optimism by newen on Wednesday January 24, 2018 @09:32AM (#16222937)
Because small invisible changes in the code text can result in actual changes in the logic of the code.
Re:Perl 6 Optimism by toyg on Wednesday January 24, 2018 @10:01AM (#16223154)
They are not invisible in any half-decent editor.
Re:Perl 6 Optimism by newen on Wednesday January 24, 2018 @10:22AM (#16223317)
But in the majority of editors that actual people use (mainly, jupyter/ipython), they are invisible. Not to distract from my point though, which is that a good programming language should be easily editable from Notepad.
Re:Perl 6 Optimism by toyg on Wednesday January 24, 2018 @10:21PM (#16228504)
This is where your bias shows. You define this "majority of people" by looking at your niche - you must be in academia or big data. I can tell you that in my niche nobody knows what the hell jupyter even is, and they use real editors like PyCharm, emacs, vim and so on, where whitespace is never a problem.

> a good programming language should be easily editable from Notepad.

The '90s called, they want their notepad back. Please. Not even Windows users run Notepad, anybody with a minimum of knowledge will use Notepad++. And guess what, N++ has plenty of features to deal with whitespace.

Re:Perl 6 Optimism by newen on Thursday January 25, 2018 @10:09AM (#16231232)
Yeah, point taken about my bias. Dealing with python via jupyter has been my biggest source of frustration with python.

But there are still plenty of cases where you will come across python via a bad interface, such as a shell interface to a server that I haven't set up properly (I come across this a lot since I've a lot of code running in clusters), and new computers or other people's bad setups or computers.

Even when using elpy-mode in Emacs, I've had problems when I tried to tabify and untabify a file (to change indentation length), which completely changed program logic in multiple places, and resulted in subtle bugs that I caught much later.

Re:Perl 6 Optimism by hedora on Tuesday January 23, 2018 @10:22AM (#16214232)
Python was designed for doing quick throw away prototypes. Perl 5 was designed to support devops before that was a word. If you are writing a large code base in either, there is a good chance you are doing something horribly wrong. (I still prefer perl though)
Re:Perl 6 Optimism by vgy7ujm on Tuesday January 23, 2018 @10:23AM (#16214244)
Indentation + characters for scope is a lot more visual IMO than just using indentation with no clear end marker.
Re:Perl 6 Optimism by cutler on Tuesday January 23, 2018 @09:05PM (#16219757)
If Python's identation-based scope is so obvious why does the language have to resort to "global" and "nonlocal" all over the place? Python is a crippled language hiding behind a veil of readability.