« first day (2271 days earlier)      last day (2667 days later) » 

12:08 AM
@eddwinpaz can you please read and follow the room rules?
 
12:34 AM
@vaultah bananas
 
Hey @vaultah :-)
 
Heya
 
... I think I explain my rationale reasonably in the target's comment thread at stackoverflow.com/questions/41369408/…
(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)
 
12:55 AM
I'm familiar with that Meta Q/A, and I agree with the top-voted answer
> If the new question is a better question or has better answers
The dupe target isn't really better IMO, and there's just one good answer
 
The difference (augmented vs. plain assignment) in the Q is tiny, I admit.
 
It's not uncommon for answers to old questions to float to the top eventually
(the Necromancer badge)
 
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.
 
You could comment on those answers to explain why they're bad
 
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.
 
1:09 AM
I think it would be better to ask the community about this case
Either this room or Meta
 
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.
 
Cbg
I agree that the old question has dangerous answers so Zero's new one is better.
But I haven't read both pages thoroughly yet.
 
1:28 AM
I completely agree that Zero's answer is better. However, it's the only good answer on the dupe target
 
This question and the one it's currently marked duplicate of are under discussion in the Python chatroom. — Zero Piraeus 25 secs ago
Just so @vaultah's comment doesn't appear to be left hanging
I'm gonna head off and watch TV for a bit ... will drop back in here tomorrow to see whether others have an input. rbrb all ... o/
 
 
2 hours later…
3:06 AM
hey
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 ??
 
 
5 hours later…
8:18 AM
@Dariusz yes, you can access, but most likely you shouldn't do it.
 
8:33 AM
cbg
 
8:46 AM
@Dariusz you can access them via A.json and B.math, but you shouldn't need to do that. Just import them again
 
Cabbage
 
Also worth noting that second and subsequent imports are cheap - the existing module object is reused.
 
@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".
 
9:00 AM
Cabbage!
Happy New Cabbage!
 
9:11 AM
@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).
 
9:23 AM
Cabbage
@poke happy new year :)
Hi @Zero, Long time no see.
 
Wotcha. Just hanging around for a bit in case anyone wants to weigh in on this, really.
Specifically ROs or blue people like yourself, I guess :-)
 
9:45 AM
ty
 
9:59 AM
@ZeroPiraeus wat :D cbg zero
 
cbg :-)
 
One problem with all of these is that as they said, the original is the first google hit of UnboundLocalError...
and the thing is, there might not even be a global variable involved, say:
def foo(l=[]):
    for i in l:
        do_something()
    else:
        print(i, 'was the last element in the list')
foo() -> UnboundLocalError: local variable 'i' referenced before assignment
 
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.
 
10:27 AM
F**K PYCHARM
the exclusion feature doesn't work
I always navigate to a temp build file by the same name... edit there...
run, doesn't work - well why would it as my changes were overwritten by the build
there are lies, damned lies, statistics and finally there is PyCharm documentation.
 
11:30 AM
cabbage
 
haha @AnttiHaapala
use emacs
its little problematic but will handling most things easily
 
11:57 AM
Happy new cbg!
Oh wow, someone else already said that
 
12:09 PM
cbg new happy!
I bet that one's new. :-)
 
new cbg happy!
 
happy cbg new?
 
12:33 PM
HappyYear() (no need new in snake language)
 
12:51 PM
re-cbg
TIL how to make scrollbars appear in turtle. It's weird that that information isn't explicitly given in the docs.
 
recbg
 
I wanted scrollbars for the turtle version I just added to my prime path answer over on SE.mathematics.
Thank you, anonymous upvoter. ;)
 
this would make a decent codegolf challenge
 
1:09 PM
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.
 
now hating: HTML5
 
hater
 
haters gonna hate
 
Finns gonna Finn
 
Finland doesn't exist
 
1:22 PM
lemon
 
rao
 
:34895658 "finnished " or "danished"? ;)
Hmm. I wonder why that isn't linking properly to chat.stackoverflow.com/transcript/message/34895658#34895658
 
user was deleted
 
hmm
weird feature
 
@rlemon I meant this lemon sopython.com/salad/?highlight=Lemon :P
 
1:35 PM
@rlemon Ah, of course.
 
Morning cabbage
 
cabbage
 
1:54 PM
lunch brbrb
 
Is this a reasonable comment?
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 2Ring 1 min ago
 
i live in finland. it's actually a tunnel to the center of the moon.
 
2:14 PM
morning everyone
 
\o good morning
back to the grind people? holiday is over ?
 
grind? Python is fun!
weeeee
 
I've been grinding Project Euler, and Python is fun! :D
 
I'm Merican, we only have 1 day off
 
@PM2Ring That's a perfectly reasonable comment. And approach
 
2:21 PM
Ta, Wayne.
 
That being said, some people are awful, so, there's that.
 
Yeah, that's why I ended my comment with ellipsis. Not everyone documents their code libraries nicely.
 
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.
 
2:29 PM
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"
 
anyone remember the module that shows the call stack of a function running ?
 
Neither of which are satisfying to me.
 
@MooingRawr inspect?
 
yes thanks vault
 
or traceback
 
2:30 PM
inspect was theo ne i was thinking of traceback was the one i googled
 
2017 cabbage all
 
cbg
 
welcome back david, how was your holiday
 
happy boot year to you
 
2:32 PM
cabbage @davidism
 
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.
 
what's the story behind you couch crashing?
 
I assumed new year's eve party
 
Yeah. My friend invited me to their friend's house, and I did not know this friend-of-a-friend.
 
The more pressing question is: why was it damp?
 
2:36 PM
oh... that's how the stranger came into play ... thought you just met a random person at the bar and went back to crash at their place
 
And the even more pressing question is: was it damp enough to be moist?
 
I was dozing on the couch and I drifted beyond the point of conscious motor control and spilled the glass of water I was holding.
 
I was expecting some drool halfway into that sentence:D
 
so you wet yourself, nice....
 
I didn't tell anyone. I'm hoping no one noticed the next day and asked, "why is the couch Kevin slept on damp?"
 
2:39 PM
-insert some bio fluid misfunction joke-
 
Precisely.
 
@Kevin I like how you use the hat that required the least amount of work from yourself.
 
It reflects my life strategy of overcoming obstacles using the least amount of energy possible. Philosophical aikido.
 
heh
 
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.
 
2:50 PM
Speaking of hats, why is @Bhargav not in the lead?!
 
mod stuff?
 
pah
@Kevin I don’t think I do, yet I’m able to imagine.
 
in Ye Olde Hat Shoppe on The Stack Exchange Network Chat, 2 days ago, by Bhargav Rao
If I weren't a mod, I'd 100% participate in WB with full zeal.
 
:<
 
Question is: is it a moral or a time-management kind of handicap?
 
2:51 PM
No time to even look at the python question feed. So many dupes are lying across since 2 months :(
 
 
@Kevin ah, thanks for the clarification
 
@Kevin What the what
How did you?!
How is that even possible?!
 
Porky has some sick hand muscles
 
How does one search for that?!?!?!
 
2:52 PM
:D
 
*mind blown*
 
I googled "daffy spin thrust" (the latter part of which is the dialogue from that scene) and got enormously lucky
 
Just search what Kevin said :D
 
Forming effective google searches is an important part of my philosophical aikido.
In describing the path, I begin to walk it.
I suspect Just how random is it possible for Python to be? is a dupe of any number of questions like "how do I choose N items at random from a list of M items (with N <= M) with no repeats?"
The standard answer being, I think "shuffle once, then pop N times"
 
> because of the crypt0graphic nature of the app
 
3:00 PM
I'm going to nominate Pick N items at random from sequence of unknown length but I won't hammer because I'm not completely sure of my interpretation
 
OP is in the process of shooting somebody else in the foot
 
Hello guys! Just wanted to wish you a happy coding year since I just earned a privilege to actually do so! :) I guess I will see you around...
 
I think OP's concern is randomness, rather than sampling
I think the import secrets answer is what OP means
@MarjanModerc Delightful! Thanks, and happy new year to you too!:)
 
Ok, I definitely won't hammer then, because it's only a dupe of the question he asked and not the question he meant to ask.
I don't like to close as dupe if doing so leaves the OP in a position of "but I still have my problem..."
 
@Kevin well, assuming that I understood them correctly.
the real answer probably contains "don't roll your own crypto"
 
3:02 PM
That's always the answer ;-)
 
FWIW, you could hammer it, then wait for the OP to object and then un-hammer. :)
And you'll get a hat - No Longer Grinchy: participate in successfully reopening or undeleting a question
 
Yes, but I can't guarantee that I'll respond to main site pings promptly today, so I'm leaning towards permissiveness.
Better that than creating an impression of "those ivory tower eggheads at SO ignore the voice of the little guys"
 
screw the little guy, close it as unclear
 
Close all questions and lurk wraithlike through the empty streets. #ghosttownaesthetic
 
I wish:P
> 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.
 
3:19 PM
(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.
Aug 24 '16 at 13:57, by Kevin
@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.
Aug 24 '16 at 14:10, by Kevin
What does it mean to roll your own crypto, anyway? If I use hashlib instead of implementing MD5* myself, does that count?
 
find a black box that says "ENCRYPT" ;)
 
Aug 24 '16 at 13:57, by Kevin
I guess I'm supposed to wait for the ghost of Alan Turing to cobble together something while I sleep
 
3:43 PM
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.
 
the obvious solution is to always go to N+1
 
Even with N = the total number of known exploits, you still get pwned by zero day attacks.
 
you know what's super annoying? When people make extraneous libraries instead of just telling people how to do it
 
3:48 PM
@Kevin but at least you can't do anything about that, so it's nothing to worry about
 
"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.
 
well, "no code" is as secure as can be
 
KIMCHI!!!!!!!!!!!
 
Intriguing battle cry, 8/10
 
thank you
 
4:00 PM
hiya Joe
 
word
 
i kinda wonder if i should go back to school to take my master in crypto so i can land a job in info security or something lol
but then i wonder if it would have been worth it ....
 
"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.
 
2017 is the year Kevin publishes. I feel it.
 
when do you feel SO's python book to come out ?
 
Rhubarb
 
rbrb
 
DSM
Or-the-year-we-publish-for-him cabbage for all!
 
Someone upvoted that answer. I don't get it. I just don't.
 
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."
 
4:31 PM
is that what's being an intern like ?
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 got my first gold badge at like 35k so I'm absolutely jealous of the sub-500 gold-bage-havers.
 
rb folks
 
\o bye andy take care
 
@davidism buttload of crappy answers from that 3-days-old account. Voting fraud or dumb reader?
most of their other answers are not upvoted
 
4:55 PM
Why doesn't the first code block in codegolf.stackexchange.com/a/28851/25258 work in 3.X? I'm getting an unexpected value:
>>> patch = '\x312\x2D7'
>>> import ctypes;ctypes.c_int8.from_address(id(len(patch))+8).value=eval(patch)
>>> 2 + 2
23150663812540920758276
Did something change about the interning of small ints?
 
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.
 
int* usually means bits in other contexts
an int64 is NOT 4 BUT 8 bytes, right? (changed by popular demand; also 4 crossed out is 4)
 
@AndrasDeak i would hope so andras
 
Ok, so nevermind, it doesn't overlap into 3's address space.
 
DSM
5:03 PM
int64 is 4 bytes? What now?
 
@AndrasDeak should it be 8 bytes?
 
just checking if you're paying attention
 
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" ....
#triggered
 
both my python 2 and 3 segfaults for Kevin's code above
 
5:06 PM
But suggests possibilities such as "the 3.X int header data is no longer eight bytes long, so you're no longer modifying the desired numerical data"
 
(2.7, 3.5)
 
same
 
@AndrasDeak Not too surprising given our OSes and possibly hardware architecture are different.
 
speak for yourself
 
The behavior of the code depends on 32/64 bit processors and, idk, endianness and who knows what else
 
5:08 PM
I'll just default to assuming that segfault is the right behaviour, and windows is stupid to do anything else
 
Doing pointer math in Python is like the definition of "undefined behavior". Whatever you get, you deserve it.
Evil ctypes hack in python gives some useful illumination, here.
"[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."
 
py2 works with +16 instead of +8
and py3 fails like Kevin's
 
Currently trying to figure out how to view the value of ob_refcnt from Python...
docs.python.org/2/c-api/structures.html mentions it but I think it's only accessible from C
That answer says that Py3 ints are longs, so probably we're modifying the real data but not the right bytes of it.
>>> hex(23150663812540920758276)
'0x4e70000000840000004L'
Suspiciously round.
That theory doesn't account for two islands of nonzeroes at 4e7 and 84, though...
I'd blame the sign bit if we weren't exclusively dealing with positive numbers
Unrelated reptile picture.
@AndrasDeak What do you get from import struct; print(struct.calcsize("P"))? I get 4 in both 2.7 and 3.X.
From your description, I predict 8
 
5:35 PM
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?
 
@corvid when you say "installable files"... what do you mean?
 
wim
 
5:53 PM
@WayneWerner for example, a DMG on mac
 

« first day (2271 days earlier)      last day (2667 days later) »