Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror

Comment Re:Why? (Score 1) 127

It's insecure because .deb files can contain installation shell scripts which are executed as root each time an updated version of said .deb file is pulled down.

So by default, anyone who has write access to those repos has root on your box.

A better way would be some degree of sandboxing so a malicious package can't fuck with the entire system.

Comment Re:Why? (Score 2) 127

LTS to LTS distribution upgrades (e.g,. from 12.04 to 14.04) aren't usually possible on launch day. At least with 12.04 to 14.04, you had to wait until 14.04.1, which came a couple of months after.

Though to be honest, if your operation hinges on in-place distribution upgrades on production systems, you've got bigger problems.

Comment Re:They're called architects (Score 1) 339

As a python programmer for 15 years, I've never had a bug caused by indentation changing the logic.

I have. Once. Although I've only been programming in Python for about 8 years. It took me about 10 minutes to spot. I remember it so well because it was the first and only time I've made the mistake so far.

I honestly find it astonishing that everyone is throwing their hands up like whitespace-for-flow-control is the single stupidest thing to happen in computing. I've written a shitload of code myself, hacked on plently of people's projects, copied and pasted tons from random forums, mailing lists and websites and I cannot for the life of me figure out how anyone with actual motor control and a sensible toolchain could have had the kind of problems that justify the prevailing attitude here.

Comment Re:That's the whole problem (Score 1) 339

It literally only applies if you're invested heavily in the python community and have picked it up from there.

It applies if you want to be able to understand other people's code more easily.

So there's no long screeds about how you should never use tabs and only use spaces? And what's currently considered the "proper" amount of spacing? None of those things are obvious, and the space-vs-tab one is WAAAYY more of a minefield than K&R style braces vs GNU style (a particular form of horrendousness) or brace-on-a-new-line style.

The choice is not obvious, and there are MANY ways of doing it.

The style guide written by the author of the language says "Use 4 spaces per indentation level." Regarding tabs vs. spaces, it says "Spaces are the preferred indentation method." It says this right at the top of the document. It's also in the beginner's guide of the official documentation, and is illustrated with numerous examples in the style guide itself. It doesn't get much clearer than that.

What? No it doesn't. It's just a marginally different way of indicating blocks. If anything the lack of {} makes it shorter and so easier to nest.

Properly-formatted Python code should be limited to lines 79 characters in length. Practically speaking, you can't use more than 3 or 4 levels of indentation in 79 characters. In most cases, deeply nested logic is spun off into top-level functions or methods. If you can't do this cleanly, it's a good indication you're doing something else wrong and should consider simplifying your approach. This also has the benefit of making that logic easier to cover with unit tests.

The interpreter itself doesn't enforce most of these rules because there are always edge-cases where breaking the rules makes things more readable. PEP8 states this right at the top. It still makes 99.9% of the rest of the code easier to work with though, so it's worth it.

Comment Re:That's the whole problem (Score 4, Insightful) 339

That inability to choose how to sculpt the visual aspect of code in Python is a monstrous shortcoming

No, I think it's perfectly in-keeping with the rest of the zen of Python. Namely, there should be one (and preferably only one) obvious way to do something.

There's no bickering about bracing style, or special snowflake developers applying their own misguided style on everything. It discourages people from writing deeply nested, difficult-to-follow logic in favour of simple, flat code.

And when everybody sticks to the same conventions, it magically becomes a lot easier to read, understand, share, work on, learn from and contribute to everyone else's code.

Slashdot Top Deals

"Just Say No." - Nancy Reagan "No." - Ronald Reagan

Working...