« first day (2190 days earlier)      last day (2759 days later) » 

7:00 PM
@tristan you should sooner or later cave and admit that you're doing social studies
 
user559633
besides identifying superfluous headcount, it would be useful for identifying if your billing department spends most of their time talking about technical issues with customers
 
user559633
@AndrasDeak fun fact, if you put the word "social" anterior to another noun and it subverts its meaning
 
Hello, where I can find a code of standart Python interpeter? I want to see how the REPL system looks in it, for reproducing
 
DSM
It's casual Friday here, so I'm in an untucked plaid shirt and dark tweedy-looking but not tweed sports jacket. I look like a prof who's trying for the "cool young prof" image and not quite landing it. #fashionforward
 
@tristan my communication style celebrates social nouns
 
user559633
7:01 PM
@MaxLunar Are you comfortable reading C and Python? github.com/python/cpython
 
user559633
it's casual friday, but i'm wearing my nice sweatpants. talk about iconoclast-ing
 
yup. Jogging pants for me too
 
@tristan yes. Thank you, but also need Python version of code, if exists
 
Roots jogging pants, because Canada must always be represented
 
user559633
@MaxLunar The code is in there. Python itself isn't entirely implemented in Python.
 
7:03 PM
@MaxLunar AFAIK only pypy is written in python
 
user559633
I actually don't own sweatpants (!!!)
 
DSM
I'm wearing jeans. Those feel Canadian.
 
@DSM As the only entrant, you win first prize by default! The intended answer was this incidentally.
 
@tristan you don't know what you're missing
 
DSM
@Kevin: the RHS is different but the other tokens are the same. :-)
 
7:05 PM
Hmm, yes, I do suppose only the LHS really matters.
 
user559633
@idjaw a social life? stable income? a general feeling of well-being?
 
@tristan I'll have you know that.....nevermind, you're right.
 
@tristan to make you feel better, I've decided to stay at work til 8pm
 
It's a nice "well actually" to keep in your back pocket when someone says "the statements that appear after a return statement don't do anything"
 
user559633
@RobertGrant oof. i'm kicking off at 430 to go drink with a friend
 
7:06 PM
wait, so what is social life?
 
Feels like #1 and #3 are covered then :-)
 
death?
 
fwiw - I'm actually working from home. Jogging pants are not worn for outings
 
DSM
I had thought your office was unusually casual, even by relaxed standards.
 
oh yeah...it's totally OK to show up in jogging pants
but I don't
 
user559633
7:07 PM
@RobertGrant haha, sometimes something stressful will sleep through my shield and i'll get a tense feeling in my organs and feel like the world is half a meter too small for me to exist in it lol totally i was just kidding, #3 is covered
 
*hugs tristan*
there, you can use that when the need arises
 
user559633
:) cheers
 
user559633
Anyone have experience with the falcon framework? It bills itself as fast to respond, which seems ideal for APIs that don't use a lot of werkzeug/flask stuff
 
I don't really "do" frameworks B-)
 
wim
how do you do spoilertext in chat?
 
7:13 PM
 
wim
 
For additional convenience, use the spoiler button adder userscript
 
user559633
my client-facing API is mostly just filtering requests back to my "backend API" and making calls via FFI to c/c++, so i was thinking of spending a weekend swapping out flask for falcon and testing, unless someone has tried it and would caution otherwise
 
wim
bleh, it screwed up the indentation
 
Available at sopython.com/wiki/Userscripts or wherever fine userscripts are sold
@wim Good enough, I knew what you meant. Good work, that was the intended answer (or near as makes no difference)
tangent: "near as makes no difference" is a really oddly phrased idiom, to me.
 
wim
7:15 PM
ok take 2 view spoiler
I like puzzles. more of those!
 
the badger demands it. deliver.
now.
 
wim
I have a fun puzzle, how do you make a context manager delete his own __exit__ method ? It's tricky but possible ..
 
Creating puzzle... [-1%-------]
 
user559633
 
I see we still need to work on spoiler security...
 
7:18 PM
just right a tristan condition
 
noscript ate it for me
says something silly about an XSS attempt
 
user559633
You Wouldn't Get This From Any Other Fries would be a great alright name for a burger combo at an 80's themed diner
 
user559633
good morning brain
 
One riddle-like challenge I came up with many weeks ago was, "in one statement, create an object which supports arbitrarily deeply nested indexing. Ex. foo = ???; print(foo[4][8][15][16][23][42]. import is also allowed"
I don't recall if there's an actual solution.
 
didn't you do something like that a while ago?
 
7:21 PM
I messed around with defaultdict for like a whole day, I remember that
 
@Kevin defaultdict of defaultdicts
should be simple
 
>>> from collections import defaultdict
>>> foo = defaultdict(defaultdict)
>>> foo[1]
defaultdict(None, {})
>>> foo[1][2]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
KeyError: 2
 
user559633
is there a one statement structure that would re-assign print to something that doesn't care about name/key errors?
 
user559633
the problem statement suggests arbitrary indexing, but not returning something useful
 
Oops, I missed the closing parentheses in the problem specification. Assume there's a ) after the [42].
 
user559633
7:24 PM
UGH! You're lucky I like you (or not; i imagine you don't have a lot of ego tied up into whether or not i'm willing to correct a trivial syntax error in chat)
 
@tristan Maybe with globals().update you can make print do whatever you want, but I don't think you can catch keyerrors in the parameter list that way.
 
DSM
I can do it in two; one is going to be tricky.
 
Past Kevin could also do it in two IIRC but that technique has been lost to the sands of time
it probably involved something like x = lambda: defaultdict(x)
With our powers combined...
>>> from collections import defaultdict
>>> foo = [globals().update({"x": lambda: defaultdict(x)}), defaultdict(x)][1]
>>> foo[1][2][3][4]
defaultdict(<function <lambda> at 0x00A356A8>, {})
But it is unbeautiful.
 
yeah, the badger hates lambdas
 
I'd quite like to see an approach not using globals/locals trickery
 
7:31 PM
I have an apparently-working-but-inherently-borked version
 
user559633
Sometimes I worry that some of y'all are underutilized at work.
 
DSM
It's tough, because the natural approach is recursive, and you have to get around the fact the object isn't there yet to refer to.
 
Agreed.
Hmm, maybe something with combinators...
 
incidentally, my apparently-working-but-inherently-borked version recurses an existing object
it's like a usb stick you bought from tinydeal which turns out that isn't 128GB as advertised but rather 32 MB with a tricky firmware
>>> dd=defaultdict(lambda: defaultdict)
>>> dd=defaultdict(lambda: dd)
>>> dd[1][2][4][3][1][5]='a'
>>> dd[1][2][4][3][1][5]
'a'
 
user559633
or when the firewood you tried to order off tinder turns out to be a disappointed, angry woman
 
7:35 PM
Hm, I think your approach works even without the first line:
>>> from collections import defaultdict
>>> foo = defaultdict(lambda: foo)
>>> foo[1][2][3][4][5]
defaultdict(<function <lambda> at 0x009E56A8>, {1: defaultdict(<function <lambda> at 0x009E56A8>, {...}), 2: defaultdict(<function <lambda> at 0x009E56A8>, {...}), 3: defaultdict(<function <lambda> at 0x009E56A8>, {...}), 4: defaultdict(<function <lambda> at 0x009E56A8>, {...}), 5: defaultdict(<function <lambda> at 0x009E56A8>, {...})})
 
@Kevin trippy:D
I didn't stop to think that the lambda gets evaluated later, nice
 
DSM
... that was one of the first things I tried. Why didn't it work for me? :-(
 
@DSM but it doesn't work work
>>> foo[1][2][3][4][5]='a'
>>> foo[1][2].keys()
dict_keys([1, 2, 3, 4, 5])
the actual solution doesn't do that ^
 
DSM
Ah, right.
 
Many weeks ago I may have originally worded the challenge so that no assignment statements whatsoever were allowed. Something like "make print((???)[1][2][3][...][n]) work for N = any positive integer number of indexes"
 
DSM
7:38 PM
Is "work" just not raise an exception? If so, Andras wins.
 
In which case you can't do print((defaultdict(lambda:foo))[1][2][3][...][n]) because there's no foo to begin with
Yeah, Andras is the current champion.
 
D:
I'm at a loss for words
 
:D:
 
DSM
TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases
^^^ You know you're trying black magic when.
 
7:39 PM
Alternatively, maybe my original definition of "work" was more stringent. Past Kevin was such a drag.
>>> print((type("InfiniteIndexer", (object,), {"__getitem__": lambda self, idx: self}))()[1][2][3][4][5])
<__main__.InfiniteIndexer object at 0x00AA4290>
Doesn't satisfy any meaning of "work" that includes indexed assignment, of course
I hope it's understood that my continual goalpost-moving doesn't invalidate the success of anyone that already satisfied earlier formulations of the challenge
 
DSM
:-( Everybody's beating me today. Playing with type is how I generated the above error.
 
You inspired me ;-)
 
user559633
laters all, have a good friday/weekend
 
DSM
Cheers!
 
I can't promise I'll try. But I'll try to try.
2
 
7:48 PM
take care
 
later tristan
 
WOOOOO
 
Oh wow 9pm
 
@Kevin, code is too long for spoiler
can I put it here?
oops
"in one statement"
I guess defining a class for it is only a triumph on my scale:D
nevermind
 
wim
@AndrasDeak plagiarised from here ;)
 
8:03 PM
ahh, nice
 
Fizzy Fizzy Fizzy Fizzy Fizzy Fizzy Fizzy Fizzy Fizzy Fizzy Fizzy Fizzy Fizzy Fizzy Fizzy Fizzy Fizzy Fizzy Fizzy Fizzy Fizzy Fizzy Fizzy Fizzy Fizzy Fizzy Fizzy Fizzy HI!
 
wim
props to the guy for using a def, and poo-pooing the lameda version
 
@idjaw just my thoughts, but with only 2 Fizzies
I was just wondering if my impression of him not being around was correct
your message suggests that it was
 
wim
lmao at pts answer there
 
oh dear I almost know that guy (well, the missus knows him)
 
wim
8:06 PM
and that's what weird scoping of lambda makes your code look like ...
 
well that's intentional abuse, I don't think that counts
it's like calling out a language feature that's being (ab)used on code golf
 
wim
8:21 PM
yes but, compare the def version of "protecting" the structure from that flaw
from collections import defaultdict

def tree():
    def the_tree():
        return defaultdict(the_tree)
    return the_tree()

my_tree = tree()
my_tree[0][0]
tree = None
my_tree[1][1]
simple, using closure scope , it's much clearer how it works
who knows how the fuck tree = (lambda f: f(f))(lambda a: (lambda: defaultdict(a(a)))) works or how he came up with that
it does work, but I only knew that by testing it, I would have to study it for an hour to figure out how
 
I'm not going to keep arguing about that, my only point was that that use case is nowhere representative
and that guy is nuts, mathematically speaking
very smart dude, and very odd wiring in his head
 
wim
hmm, I will edit this version in his answer
 
so "how he came up with that" is probably similar to how Martin Büttner comes up with his stuff
@wim don't
that would conflict with author's intent, I can assure you
Editing functionally equivalent things because you like those more is a dick move. Don't be a dick.
 
wim
Disagree
 
obviously
 
wim
8:31 PM
it's an improvement on his post
 
sure
 
wim
and it's in exactly the same intent
his code was bad
but his idea was good
 
your actions speak for me
 
@RobertGrant oh there we go... thats what i was looking for !!! thank you
 
wim
@AndrasDeak I have 2 options here
1. downvote his answer and add my own
2. edit his answer to improve it, and upvote
 
user6568562
8:39 PM
Howdeeho [ :
 
wim
and you're calling 2. the "dick move" ?
 
in principle you also have the option to not downvote it
but I know you're bound to your honour of hating lambda, so you couldn't rationalize leaving that post alone
and anyway I regularly downvote content with which I disagree, so it would be odd if I chastised you for doing the same
 
wim
I'm sorry but I've been active on stack overflow for 5x longer than you, and option 2. is the more polite
 
and finally, nobody said that 1 XOR 2 are dick moves
@wim don't be sorry (I know it's just a figure of speech anyway)
I'd say it's a different kind of dick
I know it doesn't fit in with the official concept, but I find needless edits on the answers of others a violation of personal space
 
wim
Maybe in 4 years you will change your mind.
 
8:42 PM
I'm not saying I'm being rational about it, I just feel that editing stuff because you like it more that way is wrong
@wim possible
 
wim
it's a community edited site, like wikipedia
 
I could use some of that wisdom you have
anyway, I'm done, just wanted to finish my train of thought
 
wim
there's a reason everyone has edit permissions, and stackoverflow was designed this way intentionally
 
bottom line is that of course you're free to do whatever you think is best, regardless of rep or time spent
 
wim
without being called a dick, I might add .. :P
 
8:44 PM
that's not part of the bargain:P
 
@JoranBeasley sure :-)
 
wim
do you honestly like the lambda version better? I'm not understanding your gripe with the edit
 
My point is that my personal preference is irrelevant:) And that if I were pts, I'd probably have taken joy in putting together that obfuscated monster. And I'd probably feel like my tricky answer being dumbed down by your addition of a def-y version.
I would equally gripe the other way around, if you tried to codegolf his answer for conciseness
 
wim
tricky answers don't belong here, this is not codegolf
 
then there we disagree yet again:P
 
wim
8:47 PM
I regularly downvote tricky answers if they can't be salvaged by edits
 
I don't like codegolf answers in general, mind you. But the question itself begs for tricky answers in this case (at least that's how I see it)
And I'd rather not get into technical details that the lambda's name would automatically be protected from fishy stuff elsewhere in the code, as pts and the asker discussed in comments. While your def'ed version might be problematic if somebody calls something tree. At least that's my hunch, but I started this message with "I'd rather not get into technical details" because I'm quite uncertain about said details, and that's really not my point anyway.
 
wim
I don't feel that. A recursive defaultdict is sometimes a useful data structure, not just a trick.
No, the structure is protected by the closure
 
I agree, I used non-recursive-but-nested defaultdicts in the past and they're great
@wim I think I see what you mean and you're probably right
I mean, in face of your message I think I understood the actual point of the discussion in the comments there
 
user6568562
@AndrasDeak This is madness !
 
wim
this is the flaw, in case you didn't understand it
>>> tree = lambda: defaultdict(tree)
>>> my_tree = tree()
>>> my_tree[0][0]
defaultdict(<function __main__.<lambda>>, {})
>>> tree = None
>>> my_tree[1][1]
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-94-ca6067577fb9> in <module>()
----> 1 my_tree[1][1]

KeyError: 1
 
8:55 PM
@randomhopeful and look at the top answer which came later...just grab a spoon to pick up what's left of your brain afterwards
 
wim
but with the closure version, no vulnerability:
>>> my_tree = tree()
>>> my_tree[0][0]
defaultdict(<function __main__.the_tree>, {})
>>> tree = None
>>> my_tree[1][1]
defaultdict(<function __main__.the_tree>, {})
 
@wim yup, that's what I gathered after your message, thanks
 
wim
note <function __main__.the_tree> is hidden inside the scope of def tree
 
initially I just thought that you wouldn't be able to instantiate a new one if somebody screws with the variables
 
wim
I wrote in the edit "the flaw where existing instances stop working if the tree name is rebound" , any suggestions for making that clearer?
 
8:56 PM
Mar 2 at 21:11, by Kevin
Hmm, I was hoping it would be easy to make a conceptual leap from "write a function that returns itself when called" to "write a function that returns defaultdict(itself) when called" but it looks nontrivial.
We came up with it. =)
 
@wim not really, and I don't think it matters much
@QuestionC and which one of you is the time traveler?
 
Dunno yet.
 
pts' answer which we're discussing turned 3 years old not two weeks ago
 
Well there ya go, pts is the time traveller.
 
hmm...not impossible
 
9:01 PM
It's more an answer to the 'why does this work' part of it. We kinda talked about how it worked (and zoolander memes apparantly).
 
ah
I think wim was asking rhetorically, considering that he rewrote it without lambdas
 
user6568562
9:22 PM
User is most likely often drunk and won't remember application's settings
Announce the unsolicited update in congratulation phrasing "Update was really successful"
Prompt him "Restart later"
If user chooses to restart later, restart now anyway
Discard user's unsaved highlighting
 
user6568562
That's a portion of Acrobat Reader source rewritten in pseudo code
 
wim
heh
 
Highlighting? Serves them right.
 
wim
do i know what rhetorical means?
 
9:49 PM
I got a new rain design laptop stand and it is great
 
@corvid rain design?
 
@AndrasDeak this stand
 
10:04 PM
what makes it rain?
oh, Rain Design®™
 
10:56 PM
rhubarb
 
11:11 PM
Ahh, I see. Now, to find out how to set up the command line interface and make it work without python support (like a shell or something). And, on that note, when I hear eval from now on, I'm using pocket sand. — Papayaman1000 1 min ago
another soul saved ^
 

« first day (2190 days earlier)      last day (2759 days later) »