709 karma · joined Jul 11, 2014 (12y ago) · 169 submissions
comment 10y ago · link · parent
if name in names:
names[name] += 1
else:
names[name] = 1
That can actually be written as just one neat, readable line: names[name] = names[name] + 1 if name in names else 1
It may not be as readable to some who are used to spelling it out as an if/else block, but I really prefer the one line way. It reads closer to regular English I think.comment 10y ago · link · parent
Just plugging "wikileaks" into the search box returned the correct URL:
http://bigstory.ap.org/article/b70da83fd111496dbdf015acbb798...
8.
ReactOS 0.4.2 Released(reactos.org ↗)
3 points · by ferrari8608 · 10y ago · discuss
comment 10y ago · link · parent
"just for the pleasure, anyone want to try a simple
rm -rf --no-preserve-root /"
I don't have a Windows 10 computer, so I can't test this myself. I would love to know what happens though. Does this subsystem have Windows' typical self-preservation mindset, or is it full-on UNIX style?
comment 10y ago · link · parent
Namedtuples are wonderful! It's like a class with only attributes, except you don't have to define a new class and get slapped across the back of your head by more experienced programmers for creating a useless class. Access objects by index, by name, or by iteration. It's very versatile.
comment 10y ago · link · parent
comment 10y ago · link · parent
I've been using The Deepin Desktop Environment for a bit over a month now, and I have to say it is easily the best desktop environment out there for Windows users right now. It looks close enough to 7 and 10 to be familiar, but it's far easier to use. Deepin OS is now my go-to recommendation for new Linux users, especially since they have an agreement with Codeweavers to include Crossover in the distro free of charge.
comment 10y ago · link · parent
comment 10y ago · link · parent
That's a pretty large bug. Considering what JSON is supposed to be used for, passing data between two programs/processes, files larger than 1 MB should have been accounted for.
Does it freeze then crash, freeze until the OS takes care of it, or freeze temporarily then resume?
comment 10y ago · link · parent
comment 10y ago · link · parent
On the subject of printing, there are actual reasons for having this duplicate functionality. The main way to print is of course the print function in three, or print statement in two. The print function was lacking the ability to flush the buffer before that was introduced in three. You would have to call sys.stdout.flush(), whereas now the print function includes the boolean "flush" keyword argument. The second way to print is to call sys.stdout.write(), which does not automatically append a newline. That functionality was implemented in the print function with the "end" keyword argument. You can pass it an empty string in place of the newline.
So for most use cases, print() is just fine. Sometimes you want finer grained control, and for that you would use the sys module.
comment 10y ago · link · parent
I think bulletproof coffee is a bit overrated though. I tried it and couldn't get into it, and that's with very good quality coffee. A bit of heavy cream is nice sometimes though.
comment 10y ago · link · parent
Anyway, what he did was legal. There's nothing to be held accountable for. Whether or not it's right or wrong in general is not really a topic I'm interested in. Since the legal process worked as it's supposed to, I believe this to be what you might call right though. Gawker has had this coming. If they hadn't made it so easy by publishing garbage, Theil would have been powerless.