(as well as the fact that I wouldn't have hammered the Q on my account unless urged to by another user)
If there's a consensud here that I acted inappropriately, I'm happy to accept it, but it wasn't motivated by self-interest.
re: posting a new answer at the original Q: it's accepted with 65 upvotes, and I think it's quite unlikely to overcome that. I think my action is supported by the meta post meta.stackoverflow.com/questions/251938/… (also linked in the dupe comment thread).
(and of course I'd already written my answer by the time I saw the dupe in question)
However there are two highly-upvoted answers to the other Q, both of which are Dangerously Bad Advice in that they just say "use global" rather than explain why globals are bad.
If I'd seen the other Q first I might have answered there, but in this circumstance I honestly think the way things look right now is more likely to get the right information in front of people.
Yeah, I could, if my first contact had been with that question ;-) The sequence of events was that I saw a Q, answered it, noticed it get closed for spurious reasons and voted to reopen, then got into a conversation about a potential (and IMO very bad) dupe target.
Maybe there's a case for this being a merge candidate, I don't know (not really familiar with how that works either in theory or practice).
I'm reluctant to add comments at this late stage to old answers saying "this sucks, see my answer over here". I was already hesitant to hammer it in the first place for fear of it looking like gamesmanship.
... and I'm definitely not getting into editing other peoples answers ... just recently had a disagreement with someone who stuck a tl;dr at the front of one of mine that conflicted with my intent.
The room seems quiet right now; I'd be happy to drop in tomorrow morning when more of the Wise Old Ones are around. Similarly, no problem with you raising it on meta, and will try to respond if you ping me about it.
On a tangent: commiserations on the mod election; hope you realised that my Q during that was an honest request for insight into your thought process and not an attack.
Python module questions, module A > import json module B > import math module C Import module A and B, but does it have access to json and math that were imported in A and B or I need to reimport it again ??
@Dariusz What they said. The normal way to do this is to put the import json and import math statements in module C. The interpreter won't actually re-load the json & math modules from disk, so it's fairly efficient. Ninja'd by Zero. :)
And, perhaps, I should mention that A's importing of json is a detail of A's implementation, and importing it in C leaks that information and creates an unnecessary dependency between the modules.
Can you do something like this in Python: https://www.amcharts.com/visited_countries/ I mean: Have a map and each country gets recognized, so that the boarder is the "button".
@manuzi1 That's SVG (take a look at the source), so ... depends what you mean, I guess. You can certainly serve SVG over HTTP with Python, embed it in HTML with a templating language and web framework, manipulate and/or generate it server-side, etc. Client-side Python in the browser has to be translated to Javascript (and there are tools to do that, but it's not common).
Interesting take ... I don't think the Google thing really matters; it's not as if dupes get deleted, and having a good dupe target is more likely to get a good answer in front of people than trying to overcome the upvote/accept inertia.
re: foo() - yep, there are other ways to see an UnboundLocalError. Perhaps the solution to that is a canonical "How can an UnboundLocalError occur?" QA covering the bases.
... which could end up being the canonical dupe target for both of these, of course. Not planning to write it myself, though.
I suppose so. I'm tempted to do a vector-graphics version in PostScript. Or maybe Python (or even JavaScript) with output in SVG.
Actually, Tkinter has a method for saving graphics in PostScript. But I don't know how ugly its output is. Machine-generated PostScript tends to be fairly verbose.
IMHO, functions that mutate any of their arguments ought to document that behaviour, so you shouldn't need to write such a testing function... — PM 2Ring1 min ago
Today I am annoyed by level 2 of Gunpoint where it's seemingly impossible to finish the level with 0/0/0 noise/kills/witnesses. I can't do a perfect stealth run under these conditions.
I found a video guide that demonstrates how you can approach a guard from behind, just barely graze the back of their hitbox, then jump out of sight when they turn around, changing their state from "stand guard" to "patrol" without blowing your cover. but the description says it's "nonreproducible"
Which either means "this is possible, but you'll never be able to do it consistently" or "this is obviously buggy behavior and may get patched out without notice"
I successfully did not have a hangover on Jan 1, so I expect this year to be better than the last.
I did however have only fitful rest on a slightly damp stranger's couch, which I'd say still portents a nonzero amount of misfortune for the remainder of the year.
The couch was slightly damp, not the stranger. Well, the stranger might have been damp too. I didn't check.
You know that one Looney Tunes short where Daffy-as-Robin-Hood is doing his elaborate quarterstaff routine and Porky-as-Friar-Tuck gently extends a twig at just the right moment and it sends Daffy spiraling into the river below? Life goals right there.
> Not ever using the same number/string twice in the same message is a worse security flaw than the one used to crack the Enigma during WW2.
> Fourth, and most important, you should never roll your own crypto unless you have a degree in cryptography. Check what the state of the art is, and use that instead. Crypto SE knows their stuff, and so does Security SE.
(putting on my contrarian hat) the one time I actually had to use crypto, I had no idea where to begin because "don't roll your own crypto" discouraged me from experimenting with any concepts in the past
I had well-established component pieces at hand (hashing, salting, etc), but even plugging them together seemed like a violation. But there was no single homogeneous ready-made solution for me.
And that's one of the reasons why I haven't been working on CabbageBot.
@JonClements I'm deeply pondering the authentication scheme. The problem with "don't roll your own crypto unless you know what you're doing" is, it's not actionable; I'm wisely not rolling my own crypto, but now nothing is getting done.
PyCrypto is supposed to be pretty good, but you do need to read the docs thoroughly, and in many cases you need to do further research to know what the various parts are for and how they should be used.
Looking at disastrous security flaws popping up every once in a while, I don't think anybody can spare a lot of reading into if they want to do crypto right
At the time I felt that I could never possibly read the literature thoroughly enough to feel secure. For any N, if I guarded against N possible attack vectors, malicious users would merely use exploit N+1.
"Yeah of course you can't reach the impossible ideal of 100% security, so just asymptotically approach it to a reasonable degree given your time/energy constraints", you hypothetically say. I find that distasteful. I want my program to behave in a provably consistent manner, or I don't want to bother.
"Your rigid adherence to design principles which you pretty much made up whole-cloth is stunting your growth as a programmer, and indeed, as a human being. Learn to deal with uncertainty, you wet blanket", you hypothetically say. Wow. You really know how to cut me deep there.
I'm pretty sure I released all my messages into the public domain, but please send me a fat residuals check anyway, thanks in advance
When the "shit Kevin says" twitter account gets its own television show, I want a cushy "executive producer" job. Mostly I'll sit in one of these chairs and make unreasonable demands of the interns.
Nothing that violates their dignity, mind. Just, like, requests for extremely elaborate coffees.
"No, no. I asked for honey and chocolate syrup. This is chocolate syrup and honey. I can taste the ordering"
"Go back and try again, but this time with feeling"
"Get me a large. Not a venti, a large. Yes, I know they don't do that. Give the cashier this bribe money, he knows the drill."
I'm kinda jelly when I see a sub 500 rep having a gold badge. I'm even more jelly if that badge is the 100 consecutive days, since that's the badge I've been working on for the last few months, but I keep dropping it on weekends ;(
I don't understand the pointer arithmetic there, even though it works under 2.7. Why add 8 to 4's address? From [id(x) for x in range(10)] I can see that small ints are separated twelve bytes apart in descending order, so interpreting id(4)+8 as an eight bit int would give you the rightmost four bytes of 4 and the leftmost four bytes of 3.
Or, hang on, does "int8" mean an eight bit int or an eight byte int? I'm all turned around now.
New theory: the first eight bytes of 4's address space are header data, and the following byte contains the actual numerical data we're trying to modify.
This model accurately predicts 2.7's behavior, but gives no information about why 3.X misbehaves.
man i remember having a discussion with this co worker on python's tab spacing, and his stupid quote ruffly my feathers a bit "any language that depends on white spacing to run code, is just an experiment gone wrong. Don't know why you like python so much" ....
"[a magic offset of] 8 would be "correct" on a 32-bit platform where ob_refcnt and ob_type are 4 bytes each; on a 64-bit platform this will be different. Essentially you're trying to go past PyObject_HEAD to the rest of the integer object, so try checking the size of PyObject in a compiler or debugger."
When creating a desktop application, does anyone know of any services that will build the installable files with a hash and distribute them somewhere for each branch?