« first day (2278 days earlier)      last day (2895 days later) » 

15:00
@PM2Ring return s
that's why you have a closure
but yeah, that's what I meant:)
Antti disassembled it already
@PM2Ring you're using wrong var :P
@AndrasDeak Oops. That was a typo. I specifically used s1 and s so it was obvious which was which. :(
so I think my debian/gnome is leaking memory
Take 2:
from dis import dis

def f(s1):
    def g(n, s=s1):
        return s * n
    return g

h = f('a')
print([h(i) for i in (1,2,3)])

h = f('b')
print([h(i) for i in (4,5,6)])

dis(f)
#output
['a', 'aa', 'aaa']
['bbbb', 'bbbbb', 'bbbbbb']
 32           0 LOAD_FAST                0 (s1)
              3 LOAD_CONST               1 (<code object g at 0xb718cac0, file "./qtest.py", line 32>)
              6 LOAD_CONST               2 ('f.<locals>.g')
              9 MAKE_FUNCTION            1
             12 STORE_FAST               1 (g)

 34          15 LOAD_FAST                1 (g)
             18 RETURN_VALUE
Ah, back. Glad I was able to start a conversation :)
15:07
Make sure to read it all. In real-time, for best effect. Take a seven second break between messages.
Or just read this TLDR: it's complicated but you probably don't need to worry about it
DSM
DSM
Tuesday cabbage for all.
@DSM \o cbg how goes it
@Code-Apprentice \o cbg how goes it
\o @MooingRawr
I haven't written any code for a few days...and I can't decide which of my projects to work on.
I'm stuck with my current python project
thinking about starting some kind of stock trading bot...
have an Android app to work on...
15:20
@AndyK \o how goes it
ok matey
and a new app that I started but haven't finished enough to publish yet.
What kind of Android app?
Recently got into it myself but it's been hard to find others for some reason
find other what?
What android module do you guys use? Kivy ?
15:23
that's not an android module
nah, I'm doing plain ol' Java
Other Android devs
@MooingRawr I just use Android Studio / plain Java
You should join room 15. @MarcusS
15:24
boom. Multiple agile tasks done, merge conflicts done and car is ready from the loving it needed in the garage. Time to get to work
rbrb for now
haha, Indeed is in Spanish for me. Well, the buttons and links not the job descriptions and other content.
I refuse to use java >< c# is my limit lol
java's great
guess im not making android apps anytime soon
My main complaint about Android/Java though is that there's just a ton of code involved for what you'd assume were simple things
Things get verbose quickly
15:33
You can do Android in C# with Xamarin
or even in Python...but I haven't looked into that much. From what I hear, your app is a little bloated since you have to include a Python runtime.
What do you use for your db?
I tried hand-writing the CRUD but it was just too crazy
I want to create an online database with some cloud service and a rest api. I haven't had time to do much with that, though.
Yah, all my crud code is hand-written. My database is very simple, though. One table with like 8 columns.
15:37
have you published anything yet?
no, still working on it, off-and-on
also debating whether it should be free or priced etc
from my experience, if you want both a free version and a paid version, it is best to just post a single free app with in-app purchases. Maintaining two separate listings is a PITA.
Yeah
Not sure how I'd best apply it in my case / if it'd even make sense, really (mine is a fitness app)
I currently have two listings for basically the same app. The Lite version has ads and the Premium version doesn't.
yah, finding value-added features that customers will pay for is tough.
and finding the right price point, too
Do ads vs. no ads require two separate app releases?
15:46
nah, you can do that with in-app purchaes afaik
I was just a noob when I did that ;-(
aww...man, forgot to submit my SQ purchase for today ;-(
The more I use node, the more I realize Flask's SQLAlchemy is actually extremely good :|
SQLAlchemy is actually orthogonal to Flask, rather than being a part of it. But Flask+SQLAlchemy is better than either RoR or Django (IMO)
did not die because of Christmas's and NYE's dinner @MooingRawr
@AndyK good to hear bud. xD I thought maybe you were a pre recording just in case, and you have like a back log of a few years
yay! Got my ETrade API keys!
15:59
@holdenweb Yeah but that means it's well-designed if it's not dependent on flask. I just find it super easy to use and incredibly intuitive, javascript doesn't have anything similar, and I dislike Ruby a lot in general
well, for the sandbox anyway. Need to fill out some paperwork for full access. Strange that they want me to fill out a PDF (non-form) and email it back. Do I have to print it out, fill in the banks with handwriting (gasp!), scan it back in, then email it?
#lmao man @MooingRawr
working my b*** off recently
feels like I'm not seeing daylight
oh...one of the PDF's appears editable. Not sure if I can save it after I fill in the blanks, though.
Why do OPs make it so hard to help them... It's taken over 40 minutes to clarify that the "sample output" in this question is the expected output and not the actual output .
i need a new python side project to do for fun but ideas are far and few for me lol
16:17
@MooingRawr there's always sopython-site
also shanty, my SO API project
@davidism got a link? maybe i can read about it, no promises on me knowing how to fix or change anything lo
thanks ill pull it when i get home
@PM2Ring 40 mins of constant back and forth or 40 mins with some lag between responses?
Fairly constant back & forth, but with a couple of minutes between responses. See for yourself. If you want to see more accurate timestamps hover over the "x mins ago" links.
16:25
I wonder if a multiple choice quiz before asking a question on SO would help anything.
rb folks
> Here are some questions: Is this a low-quality, high-quality, or acceptable question? ... You ranked that low-quality. What is wrong with the question? (check all that apply)
@WayneWerner Hmm...that's an interesting idea. Or maybe a short answer quiz: 1) What is the problem? 2) What is the output you get? 3) What is the code that produces this output? 4) How does the output differ from what you want?
That's just a quick draft...but something along those lines
require a complete docker environment to reproduce the question :D
The "What is the problem?" question could be refined a bit. Maybe with "Are you experiencing a) a compiler error or b) a logic run-time error?"
16:29
The juxtaposition is perfect on the starboard right now
DSM
DSM
Heh
Man they get into some weird discussions over in the JS room
haha you got that flag too?
everybody >10k does:P
or "got" as in "read in time"?
I mean... I thought we get into some OT discussions around here, but wow
16:32
@AndrasDeak yeah read in time
I missed it ;-(
@WayneWerner Yeah...there's OT and then there's "but why?"
Unrelated: can a program leak memory in a way that memory doesn't get freed after the program ends? Talking about linux.
(something in) my debian seems to leak memory, and even after restaring gnome/killing Xorg I didn't get it back
Hi does anyone know a good tutorial regarding splash? I'm trying to install it using their documentation, but I have no clue what to do.
16:33
so either the OS is leaking it, or I have a malformed notion of memory leaks
@Code-Apprentice It was a misogyinistic comment disguised as chivalry. It was weird.
Intriguing
After how long with the box running, @andras
~1 week
and the fun goes on in js
even weirder: gkrellm told me that I had all the memory available, but my gnome system monitor and free -m told me that 70% was unavailable, but top didn't show anything with measurable memory usage
16:35
checking out the transcript for a moment
Hmm a week isn't that long really. Does sound a bit odd.
🎶 True colors, shiining 🎶
and it could be that the system monitor and free somehow miss buffers/cache, but my system started swapping after reaching the apparantly small amount of memory available, so it's probably not that
(in response to the interesting JS discussions)
morning hygiene rhubarb
16:38
rbrb
@AndrasDeak my vaguely vague hand wavy thought is that it's probably some kind of caching that could be cleared, but it still appears strange.
cabbage, folks!
thanks, I'm glad it's not just me
Do you experience any actual symptoms? Slowing down, out of memory errors etc.?
cbg
@JRichardSnape only when I go above the remaining memory:P
16:40
:D smacked down.
so, after restarting firefox (with buttload of tabs), gkrellm told me I had ~4 gigs free, everything else told me I had 1.5 gigs
when I started a memory-intense python script within ulimit -Sv 2000000, it ate the rest of the memory and induced thrashing in my laptop
which means that the OS also believed that I had only 1.5 gigs free
Mmm, I have noticed firefox has been accumulating memory in recent versions. But that's not really the same as what you're experiencing.
As you say, it appears the OS thinks you have only the 1.5 available.
yup
I also fail to see why gkrellm thinks I have more available
Air
Air
Cabbage teh room.
I just found out about PEP 498. What the hell happened to just one obvious way to do things?
@Air \o how goes it
16:44
I might try stuff here, including additional sniffing around with ps, and resetting cache if all else fails
@AndrasDeak Are you having your chrome opened from too long (weeks)? I once faced similar stuff.
@Air 'it %s already'%'was' + 'too late for {}'.format('that')
@MoinuddinQuadri not chrome, and no
DSM
DSM
@Air: yeah.. but on the bright side, the New Way is actually a lot better, and will very rapidly become the new normal.
the fact that firefox gobbles memory with 400 open tabs and a dozen active SO tabs is unsurprising, but restarting firefox used to and should fix that (it worked in ubuntu)
Air
Air
@DSM I happen to like string.format
16:46
I can't tell if some of that is somehow retained, or that the missing memory is unrelated to firefox
Air
Air
I'm still chewing through the rationale for this one
@AndrasDeak don't forget template strings
DSM
DSM
@Air: I've never liked the mandatory duplication of variable names.
@Air meh
Air
Air
@DSM You mean '{foo}'.format(foo=foo)?
I only have an issue with the name, but I'm aware that string interpolation is an established term
16:49
I have a stats question for anyone who's interested
Just ask your question. No need to ask to ask.
just announcing to the room. Already writing up the question
Air
Air
> This PEP is driven by the desire to have a simpler way to format strings in Python. The existing ways of formatting are either error prone, inflexible, or cumbersome.
@Code-Apprentice I'm fairly certain that inspector is aware of the customs:P
Air
Air
brb starting a draft for my PEP in 2019 that will propose yet another approach for the same exact reason
I have a (binary) classification algorithm that takes about 30 features. Some of these features are nominal, some are real-valued. One of the classification models I've used is a decision tree
@AndrasDeak yah, I think I've seen him in here before.
DSM
DSM
@Air: yeah
talking about xkcd...I haven't read any recently
16:53
the decision tree returned me a ranking of the features, by importance. I have selected one of the most important features (which is binarizable by the splitting criterion chosen by the decision tree), and I have a bunch of other features as well (either real-valued or nominal, but binarizable nonetheless)
I would like to compute a correlation between my_important_feature and each of other_features
@Air There is one obvious way to do it: f'{the_other_ways}'. It just wasn't obvious until hindsight ;)
could anyone suggest a correlation measure to use? I'm currently using the Phi coefficient. Could someone validate/update this choice?
Air
Air
@WayneWerner "eff the other ways" - I read you loud and clear :P
^^ What he said. The advantage of f-strings is the avoidance of the need to associate function parameters with values to be formatted. Here's the example I used in the Nutshell:
>>> name = 'Dawn'
>>> print('{name!r} is {l} characters long'
          .format(name=name, l=len(name)))
'Dawn' is 4 characters long
Compare that with
>>> print(f'{name!r} is {len(name)} characters long')
'Dawn' is 4 characters long
@Air What DSM said. The plethora of ways to format strings is flagrantly in defiance of the "one obvious way" principle, but f-strings are awesome & highly addictive. ;)
16:57
Not only that, you can do other sneaky things much more easily:
>>> for width in 8, 11:
...     for precision in 2, 3, 4, 5:
...         print(f'{3.14159:{width}.{precision}}')
...
    3.1
   3.14
  3.142
 3.1416
       3.1
      3.14
     3.142
    3.1416
by using nested formatting
oh neat :)
and there was something about performance as well, right?
Haven't even bothered to look into that aspect of things
are they in 3.6?
oh man the new f strings look sooo pretty
17:02
they missed the opportunity to call them g-strings
If I use f-strings I can force everyone at work to upgrade to 3.6
@AndrasDeak yes, the initial implementation was a bear, performance wise.
3.6.0b1 added a new opcode to speed that up nicely.
does "a bear" imply slowness?
ah, yes
@AndrasDeak yes.
thanks
I meant that I thought that f-strings were going to be the fastest
17:03
20
Q: Why are literal formatted strings so slow in Python 3.6 alpha? (now fixed in 3.6 stable)

OrangeFlash81I've downloaded a Python 3.6 alpha build from the Python Github repository, and one of my favourite new features is literal string formatting. It can be used like so: >>> x = 2 >>> f"x is {x}" "x is 2" This appears to do the same thing as using the format function on a str instance. However, o...

cooool
Air
Air
Okay, I'm sure f-strings are hot hot hot, but please tell me ANY of these are EVER getting deprecated and removed
@MartijnPieters heh, Antti's answer there
DSM
DSM
To be honest, I'd be surprised if they were deprecated anytime before 5.0.
"this used to be slow which is why I posted an issue, now it's fixed" :D
> As the result the literal formatted strings will be much faster than string.format. They are also often much faster than the old-style formatting in Python 3.6 beta 1, if you're just interpolating strings or integers:
this is what I remembered; @Antti saying the same thing in chat
DSM
DSM
17:08
Isn't poke responsible in similar fashion for raise from None? Or am I misremembering?
all I want to do now is disassemble things
@excaza code butcher ?
dis.dis is fun
@Martijn I was going to leave the same comment right now:D
(on the late answer reiterating part of Antti's answer)
Air
Air
I've gotten used to defining my string templates in the style of constants:
FOO = 'I like {thing}'
print(FOO.format(thing='cake'))
Air
Air
Can't do that with a literal.
OOO...OOOO...three edits away from another gold badge
@Air you don't need to do that:P
@Code-Apprentice resist the urge to half-ass it:P
gonna have to start trying those out -- up until now I've been doing the whole "this {} is a {}".format("thing", "cake") thing
Air
Air
@AndrasDeak We don't "need" f-strings either?
17:16
I mean you can do print('I like {cake}') and no need to literal it;)
Air
Air
You forgot the f :P
right:D
Air
Air
But I'm not talking about whether 'cake' is a literal, I'm talking about the template
I'm stuck with 3.5
wim
wim
>>> f'I like {"cake"}'
'I like cake'
17:18
I've been doing the whole 'this %s is a %s' % ('thing', 'cake') thing :p
wim
wim
ewww
Air
Air
@wim ಠ_ಠ
I'm really used to sprintf
Air
Air
@excaza 'this %s is a %%s' % 'thing' % 'cake'
@Air True, you can't construct f-strings (easily), but you won't often find yourself needing to do that.
Air
Air
17:20
@PM2Ring Here's what frustrates me, if we have an old approach that serves 70% of the cases, and a new approach that serves 90% of the cases, why create another new approach that serves a different 90% of the cases?
Numbers pulled out of random.random (okay, cherry-picked)
@Air performance
because "serve" and "serve well" are two different things
the same reason we went to Python3 and removed ascii strings by default
Air
Air
@KevinMGranger Not mentioned once in the PEP rationale
And readability
Air
Air
@WayneWerner but Python3 swept away a fair amount of old junk, without deprecation this leaves a lot of clutter
wim
wim
17:22
f-strings are totally unnecessary, if you need it that bad just put a capo on the 1st fret
6
Air
Air
For some context, I came across the f-strings while chatting with a friend who is taking a 101 course using Python and doing some 'concat' + 'enation' in her code.
interestingly enough, that method is actually faster in some circumstances for some length strings
mostly not
Whoa, really?
Air
Air
It was already going to be a hassle to try to introduce her to string formatting in Python when I thought all I had to do was mention there's this old way, but you should use this new way
Now I feel like I have to take her on the full tour of the chocolate factory and she's going to turn into a balloon and be shredded by the fan in the ceiling
@Air hey, it's not like there has to be only one way to do things.
17:26
@Air mmmmm, chocolate
Air
Air
I'm sure my frustration will pass and I'll learn to love this new bullshit just like I did the last new bullshit, sigh
Can you tell I'm not an early adopter?
wim
wim
I love that print(f'...') looks so much like printf('...'), just to annoy some C programmers
what's your perfer xml parser for python? lxml? elementTree?
DSM
DSM
I'm not going to upgrade our 3 application at work until 3.6.1 comes out.
Other people can test-in-production for us. :-P
did it bother anyone else that wonka figured out human flight and nobody really cared?
Air
Air
17:29
@MarcusS You mean human float?
dude should have been a gazillionaire -- think of the applications
I mean he did have the factory and all, but still
Air
Air
> 'f' may not be combined with 'u'
LOL
Ok, I'm pretty sure the ImageMagick bug I've been nagging about is actually two bugs
wim
wim
hahah
fu-strings
Air
Air
>>> fu"I won't do what you tell me!"
SyntaxError: invalid syntax
>>> fu"I won't do what you tell me!"
SyntaxError: invalid syntax
>>> fu"I won't do what you tell me!"
SyntaxError: invalid syntax
wim
wim
17:35
Rage against the parser ?
Air
Air
I feel much better now.
The trouble now is, one of the bugs is easy to make test cases for, and one of them isn't, and the patch being written by the dev will only fix the former.
it wasn't the -optimize layers thing or whatever it was?
This one occurs earlier in the process when the gif frames are converted down to 256 colors. -optimize shouldn't have an effect on it either way.
(Although I think I'll go test that now to confirm...)
(yep, still broken without optimize)
DSM
DSM
@Kevin: one of my phrases at the office is "it's never just one bug".
wim
wim
17:39
Can't wait for the new g-strings in Python 3.7
Air
Air
How about some parseltongue sstrings?
I wrote a nice little automated tool that generates random images and runs them through imagemagick and detects whether the output is corrupted by doing a per-pixel comparison between the original frames and the output frames. This worked fine when detecting bug #1, but per-pixel comparison won't work for bug #2 because it's normal and expected behavior to flatten the input images from 256^3 colors to 256 colors.
wim
wim
#unsubscribe ImageMagick-bugs
The problem is that I disagree with what pixels are being flattened to what color.
DSM
DSM
Problem? Or opportunity?
17:41
snekstrings? 🐍"This" -> "Thissss"
8
@Kevin can't the bug be reproduced in bnw?
or is that irrelevant now?
@AndrasDeak Bug #1 can be, but not bug #2. At least, my random test case generator couldn't reproduce it after 500 attempts. It replicated bug #1 in two attempts.
In the one test case I have on hand, I have a large region of about 255 colors in no particular pattern, and three large adjacent rectangles of differing solid colors. When the color space is reduced, a squiggle of color worms through all three of the rectangles.
sounds weird
DSM
DSM
Dibs on "colourworms" as the name of something.
DSM
DSM
17:46
Ok, I have an idea for how I could automate this, but it would be pretty slow... Here's hoping the bug occurs frequently
DSM
DSM
Someone always got there first. :-(
nice
ipv6 finally works in my consumer net
native ipv6.
18:05
damnit! where's Fizzy when I need him?
Air
Air
@inspectorG4dget Shake up a can of soda and open it in your cubicle/office/bedroom/car to summon him
well done
The sun is streaming through my window and in the rectangle it illuminates on my desk, I can see the heat haze rising up from the space heater on my windowsill. Pretty neat.
Is this a good place to ask some questions about threading?
The effect changes in noticeability as the sun goes behind a cloud. Makes sense - you won't see haze using ambient lighting because it's pretty much maximally scattered already.
For best results you need near-parallel light rays
18:11
@sidnical: just ask! we'll chime in if we know anything :)
Using concurrent.futures.threadpoolexecutor to run log parsing on large files. If a user starts a new query i'd like the first one to stop so it doesnt lead to a load issue on the system. Once the thread starts parsing the file I dont know how to interrupt that and stop what its doing.
im only 6 months into python so I still have alot to learn. From what i've read it seems like its best to have a periodic check in the thread to see if it should continue. I dont know how I would do that if its in the middle of parsing a file and doesn't stop for anything until its done.
@MarcusS about that dynamic programming you mentioned...does that include backtracking? In that case I might actually be able to do dynamic programming:P
@AndrasDeak kinda / sorta -- they're technically a little different
too bad, I'll still have to google it one day:D
(IMO) backtracking is sort of like "smart brute force / brute force with pruning"
incrementally trying stuff and then stopping early if you know it won't be worthwhile to continue
18:23
yeah, I can see that
DP is similar in that it can be seen as incremental, but the difference is that it often has no memory of the specific path it took to get there
thanks
@AndrasDeak A good one for understanding how DP works: projecteuler.net/problem=15
@WayneWerner :D
18:25
you don't have to enumerate every single individual pathway in order to count them
@MarcusS that one I cheated:)
@AndrasDeak DP is basically a ~BFS, backtracking is often DFS
If I execute subprocess.call, is it possible for the subprocess to create a sub-sub-process that lives beyond the lifetime of the subprocess?
In other words, I have this code
img.save("input.png")
subprocess.call(["do_thing.exe", "input.png"])
os.remove("input.png")
e.g. if I ask you "what's 1 + 4 + 29 + 40" and you compute it, then I ask you the same question again but with +50 tacked onto the end, then maybe I ask you again with +60, then again with +110, etc -- you don't have to redo all that previous work computing "1 + 4 + 29 + 40" over and over again
And do_thing.exe is producing the error message "unable to open image file input.png"
18:27
@Kevin the child will be waited. but it can fork
you kept track of the incremental total (74) and worked off that subproblem each time
If I delete the remove call, everything works.
or ... in windows ... well all bets are off
I really don't want to add a time.sleep(1) call in here
@MarcusS I checked my solution for that problem, and I just computed the corresponding binomial coefficient:D I didn't remember that it was this cheating.
18:29
the binomial coefficient is the "optimal" way to solve that problem, yeah
@AndrasDeak dijkstra is an example of dynamic programming
@AnttiHaapala haven't got there, yet
either next year's AoC or a project euler challenge will get me there:P
one way to think about DP is memoization + caching
inb4 JS room is frozen
or perhaps dijkstra is not a DP :P
18:30
Oh, nevermind... In my actual code, more than one call is occurring and I deleted an intermediary file prematurely.
This doesn't eliminate the possibility of immortal children, but it's no longer a pressing concern for me
@AndrasDeak For instance if you wanted to solve PE15, you might initially try something like this:
def num_ways(r, c):
    if r < 0 or c < 0:
        return 0
    if r == 0 and c == 0:
        return 1
    return num_ways(r - 1, c) + num_ways(r, c - 1)
however this algorithm is also really slow because you're recomputing results a lot
shtsht, can't find my pe15 :P
18:35
you could memoize it
if you want to add caching / memoization:
Oh, you're explaining that
I'm fine with lru_cache:P
def num_ways(r, c, cache={}):
    key = (r, c)
    if key in cache:
        return cache[key]
    if r < 0 or c < 0:
        return 0
    if r == 0 and c == 0:
        return 1
    cache[key] = num_ways(r - 1, c) + num_ways(r, c - 1)
    return cache[key]
@AndrasDeak hmhmm ...
18:35
^is one way to do it
thanks, I see
and then if you want to move away from memoized recursion you can translate it to iterative form (any recursive algo can be made iterative)
So, a biofuel company with 13 employees, turnover of 10k€, signed a deal to provide a 130 M€ factory into India.
silly Finns, we do the same amount of corruption without having to move anything abroad
do you need a 130 M€ stadium in your back yard? DONE!
who am I kidding, you're nowhere close to our corruption
@AndrasDeak hehe, the company was -7 M€ in capital yet they ignored the law that they should inform the company registry that they've lost their share capital.
18:42
nobody can keep all those silly law thingies in their heads
@BhargavRao lol :D a Finn tells: "Indians love protocols and titles. A friend of mine received a letter signed by "Cousin of the Former Prime Minister of Punjab""
Almost like
wim
wim
@AnttiHaapala ummm, no. You've been playing AoC too much .. :P
I love protocols too. 9p and HTTP are probably my favorites.
wim
wim
DP is like divide and conquer, but done in reverse
search optimal substructure / overlapping subproblems

« first day (2278 days earlier)      last day (2895 days later) »