« first day (2896 days earlier)      last day (2277 days later) » 

21:01
sounds posh... do you do that while having cucumber sandwiches? :p
Only if Jeeves hands it to me with some tea.
Using my executive powers; motion passed, np.inf to 0
I fixed my numpy issue, using tolist not sure if that's the way to do it but it works :\ dpaste.com/3WZCHE2
Couldn't you just map the lambda without the array?
I guess next step is to implement a "scaling" to limit number of characters on the ascii art like I did in the first method
21:07
np.vectorize doesn't give you any speed up at all
u mean map it on the image?
I was hoping to add a scaling function in the numpy array later
Ok, so you're pulling it out of an array just for printing, but the actual array carries forward?
yeah wait what were you tlaking about map the lambda, what would I map it on the image or the array cuz I thought you can't direct map to ndarrays
abc
abc
Trying to integrate numpy ndarrays in the code I have something that looks like this dpaste.com/3SPTGVG I was wondering whether there is a better way to do it with numpy.
@MooingRawr Why are you using np.asarray() if it's already an array?
21:15
/shakeshead #KidsTheseDays
Amazing! I was not able to catch this. Thanks a ton. Can you also help me upvote my question :) — Kshitij Yadav 2 mins ago
oh no clue, that was a typo I guess I meant to leave it as
normalizer = np.vectorize(lambda t: gscale[int((t * 9)/255)])
n = normalizer(image)
:)
Ok, now I understand better sorry
and I realized I could just scale it using pillow before hand using thumbnail
@MooingRawr without context, that is the weirdest message I've read all day
:D part of reasons why I love Python's random naming modules/functions
21:19
Genuine news article title: "Sex pigs halt traffic after laser attack on Pokémon teens" source. I win :P
went from a 2 second on average program to a 0.1 second feels good :D
Using the thumbnail?
from manually calculating the threshold and scaling it myself to letting numpy map the calculation and pillow 'thumbnail'- ing it
Ah, nice :)
21:22
now I guess to put the colors back in but not sure how nice it will look :P
wim
wim
>>> [*chunks(range(9),2,1)]
[(0, 1), (1, 2), (2, 3), (3, 4), (4, 5), (5, 6), (6, 7), (7, 8)]
where does chunks come from?
That's not built in, cheating !!!!!
well then of course (-:
21:26
nono. It's wimpy
wim
wim
heheh
wimpy is all but dead in the UK. I only know of one place with that name
wim
wim
it's like the cooking shows when they say "here's one I prepared earlier.."
I'm totally going to pilfer some of your util
There's a breakfast place in Toronto called Wimpy
21:29
There's a town about 30 minutes from here called Haskell
wim
wim
@WayneWerner in which state? or is it stateless?
^ /nods_in_approval
Wimpy in the UK was known for overpriced and sub-par food at motorway services in the UK. Almost all of them have shut down.
The Haskell Care Center - goo.gl/maps/8oDPTuEH4aJ2 - for when you're not sure what state you're in.
There may be a worse way to do it than this, but this is getting close to the bottom. :)
[*map(lambda x: (x, x+1), range(9))]
21:32
We need Kevin to Y-combinator this
I don't use tkinter but am I right in thinking this is a common question where the function needs to be a lambda?
We had Wimpy for a while here in Oz, in the mid 60s to mid 70s. They never had a good reputation, and once McDonalds arrived they didn't survive much longer.
I see it a lot, and I think there's probably a canonical. I can recognise the pattern but I'm not confident I'm right on what I link as a dupe
wim
wim
def type():
     # whyyyyy
I seem to remember from my few weeks on tkinter that command=type is an issue
21:37
@wim take your star out for dinner tonight :D
@PM2Ring are we still code golfing or are we trying to reverse golf?
does code bowling count?
>>> m=5;import numpy as n;n.lib.stride_tricks.as_strided(n.arange(m+1),strides=(8,8),shape=(m,2)).tolist()
[[0, 1], [1, 2], [2, 3], [3, 4], [4, 5]]
@roganjosh That code is very confused. There is a common thing where people mess up the callback function, and we have a canonical for that. But that's not what's going on there. In fact, I'm not sure what's going on. I'll have to look a bit closer & think about it.
still needs a list(map(tuple,...)) instead of tolist...
disgusting
It isn't often that stride_tricks makes me lol...
21:39
My God, what have you done, Andras?
@MooingRawr It's metamorphosed. So now we're just thinking of silly ways to achieve the goal.
@roganjosh Pretty sure the guy did frame = Frame(...).pack() somewhere earlier in their code
@Aran-Fey the callbacks part of Tkinter I never understood, I played with it when I was just learning Python and never went back when I understood a bit more. But I do remember that binding functions to command directly had bad implications
Nothing that I work on now could go through something like tkinter (unless I'm really badly informed) so I don't have interest in it beyond something I see cropping up regularly on SO
wim
wim
is a good tag to ignore, so it's very annoying when guys ask tkinter questions and don't tag it as such
All my code changes take ~1 min to run before I can see whether they work as intended (on my current project). I don't ignore any tags, I try to use that time to keep the Python tag clean as a whole
21:54
@roganjosh There are two common gotchas with Tkinter widget callbacks. The simple one is when someone calls the function command=somefunc() instead of doing command=somefunc.
The more subtle one is when they want to pass an arg to the function, so they have
for i in range(5):
    tk.Button(root, text='Button {}'.format(i), command=lambda: somefunc(i)).pack()
But that won't work, due to late binding. Instead they need
for i in range(5):
    tk.Button(root, text='Button {}'.format(i), command=lambda i=i: somefunc(i)).pack()
@wim I don't mind Tkinter questions. But it's not easy to get a good answer in first if Bryan Oakley is online. :) I just wish that more OPs would post runnable code. Just adding the necessary boilerplate to get their code snippet runnable wastes half the answering time. And don't get me started on the proportion of questions that use star imports... but I guess I can blame the Tkinter docs for encouraging that.
What is command=lambda i=i: somefunc(i) called as a construct?
a no-no
It's not a named lambda, but it gets around late-binding
is it not? :P
So it is a named lambda?
22:03
why would it not be?
wim
wim
@roganjosh that's a lameda
command = (lambda i=i: somefunc(i)) # let's bind this lambda to a name
wim
wim
maybe you are asking about a closure??
Hmm ok, now I see where my confusion came from
So the Tkinter library is built on an antipattern for Python?
Have you seen any tkinter doc? Star import, 'nuff said
22:05
There's two types of code: Lazy code, and code that doesn't work
wim
wim
lazy code is just code that doesn't work, later.
spoken like a true Haskell fan
I'm sure the only people who'd see that observation in positive light are functional programming users
I actually might block tkinter as a tag. I've lived the last few years assuming that I just couldn't piece things together with no programming knowledge. Now I feel the library functioning detracts from my understanding overall
Good job they implemented those gigantic buttons so I know how to block stuff
Now I have this knowledge, I want them to give a "trigger warning" modal when you inadvertently click a question that imports tkinter
wim
wim
there was a discussion in here not too long ago about good tags to ignore, you can probably find it by searching for tkinter
22:16
stackoverflow.com/questions/52428709/… unclear. I gave a preliminary answer but I think it's going to be iterative in solving their issue. I'll delete my answer once closed.
wim
wim
I'm still waiting for the "ignore questions from rep 1 users" feature
maybe a userscript ??
Doesn't sound like you're being very welcoming. Perhaps you need a sticker or something for opening those questions
Garbage is getting through with niche tags. I'm bored of it but I keep trying to clear it up. A 1 rep user using nltk tag (random example) in their question stops a lot of people opening it. If you actually look at it, it's often garbage but they're not getting critical mass to be closed
^^ sarcasm btw
oh, I had no idea contextlib.nullcontext was new in 3.7
@AndrasDeak It's not a named lambda. It's a keyword parameter getting a lambda assigned to it.
22:31
oooh, I completely missed the context, sorry. My wetware tkinter filter removed it :)
yes, it's not a named lambda @roganjosh ^
I got fed FAKE NEWS :/
that's the pattern of how you bind a value for a callback, so I guess what wim said (closure)
Ok, then my understanding of a closure is wrong
not necessarily, because I'm historically unsure about closures :D
22:33
but there was closure talk here earlier today
"closure talk" is a bit of an overstatement
It might be better to answer if it is known what that is actually called, otherwise I'm gonna be more confused than normal :P
To me it's along the lines of the "least astonisment" dupe target, but then the behaviour for a lambda seems at odds with that
I'm not sure what you mean by "behaviour for a lambda"
the problem is that I suspect "closure" is again a thing that means something in other languages but doesn't necessarily exist in python in the same way
So "least astonishment" lines creates a single list at function definition. Using lambda in tkinter creates a callback with variable arguments?
My vague notion is that in other languages a closure is ~ when a variable in an outer scope is bound by, say, an anonymous function. I.e. sort of the opposite of the behaviour of lambda: fun(i), whereas lambda i=i: fun(i) will bind on definition which is more along the lines of what I think a closure is
It's not really a closure. It's using a default arg. Doing it without a default arg gives you a closure: tk.Button(root, text='Button {}'.format(i), command=lambda: somefunc(i)). When the button is pressed somefunc gets called with whatever i in the enclosing context happens to be at the time. Whereas tk.Button(root, text='Button {}'.format(i), command=lambda i=i: somefunc(i)) calls it with the value that i had when the lambda was defined, as per usual with default args.
22:38
@roganjosh if you mean "mutable default args" when you say "least astonishment", say that :P you're confusing me
You confused me first :P
But yes, I meant that, I had a mental blank sorry
I see life through duplicates these days :/
Aside: is there a quick way of editing posts formatted as quotes into code format?
One answer: The OP deletes the question while you ponder how best to format it correctly on chat
tensorflow should support python 3.7
@roganjosh select, quote button to unquote (fingers crossed), ctrl+k
Never works :/
22:45
but I vaguely recall that this doesn't work and there's a FR for it
Dang, I'm out of downvotes... another productive day on SO
give it 6-8 weeks
The quoting trashes indentation
@Aran-Fey did you use a review queue?
Nope, but I downvoted a bunch of sys.path.append answers on an old question
@roganjosh I hate it when that happens.
22:49
*** Reference count error detected:
an attempt was made to deallocate 7 (l) ***
oopsie
"an attempt was made" makes it sound so supportive
@CarloFedericoVescovo How come you posted 4 answers to this question? stackoverflow.com/questions/48836129/… It would be nice if you consolidated the 3 undeleted answers into a single answer and deleted the others.
@AndrasDeak Reminds me of that crazy code that Andrew Barnert posted that changes the value of a Python int.
Not sure about that particular case, but I generally wish people would post multiple answers more often. Two different solutions should be posted as 2 different answers so that they can be voted on separately
@AndrasDeak "I see async and the only thing I can think of is someone saying "I think" with a horrible horrible accent" I wonder how Peter Lorre would have pronounced it...
or Béla Lugossy :D
@PM2Ring I don't understand the flash-delete but the fact that my first instinct is "I need to edit this mess" on seeing a post is a decent enough reason that it probably shouldn't be on SO
22:58
meh, getting formatting wrong doesn't necessarily imply a useless question or hopeless asker (though it's not that hard to get it right)
I edit lots of questions. If they delete while I'm trying to edit, something is wrong
@Aran-Fey Perhaps. But plenty of the old guard would strongly disagree. In my very early days on SO I tried to do that, and 3 or 4 high-rep users harassed me into merging my answers. At least, I think they were high-rep. When you've got less than 200 points, 1000 seems like high-rep. :)
It's possible that they get a downvote in the time that I'm editing and get spooked, but otherwise it probably just saves us time closing the question
@PM2Ring "high-rep" is a moving target. I believe it's calculated as your_rep * 3.5 :(
@roganjosh Or they just have a rubber duck insight & figure there's no point in bothering anyone with a question that they've already solved.
23:03
I'm not at Andras' speed of typing, but I suspect that, at the rate I refresh the question feed, 90% of the question's lifetime exists in being typed out. It's odd that so many die in that short window of being edited.
I don't think I type particularly fast
That is pure nonsense and you know it
I guess I should check one of those typing tests one of these days
I make a lot of typos so I keep going back when I type something...that's sort of cheating because the first iteration is fast but full of mistakes
That makes your typing even faster
You've responded to me multiple times where I sit and think "that's impossible"
@roganjosh And I bet 90% of the newbies who do that don't even realise that their deleted questions live forever in the archives.
23:09
@roganjosh maybe you type much slower than you think which explains all those deleted questions... :PP
... ouch
I'm reasonably fast for someone who never learned to touch type. But I do lots of dyslexic transpositions, like 'expalin'. I almost never get that right. :)
Explicitely
^ that is mine
I couldn't spell my mother's name until about 25ish when I resolved to be certain
Beverley or Beverly
I started on my grandma's clunky old mechanical typewriter. Touch typing on those things wasn't exactly easy. I did manage to get some practice in on some more modern mechanical typewriters though. And a few years later when I started coding I was using an IBM 029 card punch, which was fun.
When I was in nursery, the gov't decided to trial a new way of reading
23:15
those always go well :D
guinea pig generation
Did you use a funny phonetic alphabet?
When you saw "cat", you couldn't spell it out as "c", "a", "t". You had to recognise the word
ah, they did that to my brother, it was hard for him to recover
although we only learn to read in elementary school :P
It's actually really tough to get out of it
"Academic" I always see it in my head as "achademic"
Some of the weirdness you can definitely overrule in your head, but some will stick and I guess it'll last a lifetime now. I'm 30 and still second-guess myself on spelling my mother's name
but your biran msut be extra fsat at pnriasg wdors mnilged in this way
23:22
^ and that's how I find typos :P
<thought completely out of the blue> Wasn't there a suggestion of this room forming a team for Kaggle competitions?
23:52
rbrb guys. G'night
Night, roganjosh.

« first day (2896 days earlier)      last day (2277 days later) »