« first day (2575 days earlier)      last day (2377 days later) » 
00:00 - 17:0017:00 - 00:00

12:08 AM
Are you using requests.session? That sped up something I wrote.
 
who are you asking?
 
SamFlynn
 
12:51 AM
Hi, I am new here, using python to solve style based capitalization problem in English.
 
 
2 hours later…
2:24 AM
@Programmer_nltk you should ask you question on the main site. You are more likely to get the help you need there in a timely fashion.
 
Howdy everyone
 
2:45 AM
cabbage
 
can I get an idea/problem of mine sniff tested?
 
3:03 AM
@br
@BrandonDube whatcha got?
 
tl;dr, I want to parallelize some code that depends on imports and putting the import statements in the function body offends my sense of aesthetics
so based on ZMQ I made a parallel processing library that uses some of the nuclear warheads in py stdlib to identify imports for functions and send some preflight stuff to the worker processes to make them import the right stuff. It's based on (ab)use of eval, exec, and globals()
it's a push/pull architecure, so there are a min. of 3 processes involved. If I run each of the ends in separate shells and spin up any number of workers in between, everything works fine. If I spawn them all from a master process, the import magic blows up for reasons beyond my feeble brain's comprehension
 
@BrandonDube got a snip to review?
 
@JGrindal MWE, or bigger pile of code?
 
@BrandonDube lets start with MWE
 
hmm ok -- gimmie a min to cook one up, I made everything into a library with more than the bare necessities
if you want to look at the larger body of code, this is the module I've been working on -- github.com/brandondube/magicmp/tree/master/magicmp
does chat have code formatting for a MWE?
test post pls ignore
oh.
I just realized that I've wasted...a long time on this
there is a way to use functions that depend on imports with process pools using multiprocessing.Pool
 
 
2 hours later…
5:38 AM
@BrandonDube that's awful
are you on NIX and using the ordinary spawner there?
are you using shared memory?
some of these libs is using threads or got import-time side effects?
 
5:56 AM
Morning cbg
 
@AnttiHaapala win64/py3.6.3 -- I iterate these things in Jupyter, which handles main a bit differently when you use the autoreload extension. That was making anything with multiprocessing.Pool require the imports to be in the body, since when the process was spawned it would miss the imports in the spin up. Making it a script makes mp.Pool work beautifully.
I still wonder if I could do a bit better by caching the args of a partial object since they can be quite heavy, but it isn't worth the instability and development time. RIP magicmp
 
the entire multiprocessing is...
at least you're using it on windows so no shared memory woes, threading woes etc :D
 
why does cPython even have a threading module?
the GIL makes it +- useless
 
6:18 AM
I read a line from file in the following format ' MACHINE_MAP["1.1.1.1"] = ("user", "pass", "22", 1, [COMMON], [group1,group2,group3]) ` and I want to take group1,group2,group3 as a list
i tried groups = line.split("=")[1].split(",")[-1]
but this gives me only group3
my command would run fine on strings like MACHINE_MAP["1.1.1.1"] = ("user", "pass", "22", 1, [COMMON], [group1])
but not when there are multiple groups
can anyone help with a regex for this or is there something im missing
 
I mean, you can run things that do a lot of waiting in threads. Like HTTP requests and stuff
 
6:35 AM
@pythonRcpp I think you need a parser, eg pyparsing
 
or you can use asyncio which is simply way better
just needto add some awaits
and @RainerKoirikivi cbg
Oulu concentration getting higher it seems
and I need to buy a new keyboard
my h is not working well any more. I guess it is not a good thing to pour rice and fish with sticky sauce inside the keyboard
@BrandonDube threads help with 2 things: parallelization and concurrency.
 
@pythonRcpp .*\[(.*)(?=\]\)$) should give you group1,group2,group3, so just split that on commas
 
6:52 AM
cbg Antti
 
7:43 AM
@Rawing awsome.... but would appreciate an explanation aswell . Thanks
 
.* skips as much of the string as possible, so the regex only finds the last occurence. \[ matches the opening bracket. (.*) captures all the text inside the brackets. (?=\]\)$) (or just \]\)$) then matches the last two characters in the string, because we don't want those in the capture group
      MACHINE_MAP["1.1.1.1"] = ("user", "pass", "22", 1, [COMMON], [group1])
.*    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
\[                                                                 ^
(.*)                                                                ^^^^^^
\]\)$                                                                     ^^
 
8:02 AM
@Code-Apprentice Sure. thanks.
 
8:15 AM
@AnttiHaapala 4 down, 1 to go...
I think the error is on line 7. — PM 2Ring 27 secs ago
I've been wanting to do something like that for so long. ;)
 
@AnttiHaapala 1 more vote needed
 
8:46 AM
@AnttiHaapala on hold now, go crazy
 
yo @AnttiHaapala
 
Ola!
cbg
 
9:01 AM
Privet
 
is that a word from python language?
hi andras
 
@thefourtheye You're still alive?!
 
@Катерина he he he, yup :D
 
Holy shit that's a miracle
haha
 
9:06 AM
Why? I have been alive since my birth :D
 
haha
has been a while
 
How are you?
 
Good good, actually working as a developer these days :D Wbu?
 
@ColdFire yo
 
That's great news :-) Awesome.
 
9:07 AM
hey 4eye
 
I don't think I know anything other than being a developer ;-)
 
hehe
How is life?
 
@ColdFire Hello Cold Fire!
@Катерина Very busy :-/ Lot of work and expectations...
Which technology do you use at work?
 
Oh dear, busy is good tho.
I work with C#
 
Idle mind is the devil's workshop, eh? ;-)
 
9:09 AM
doing web applications with ASP.Net Mvc
Exactly hehe
 
Nice... You have become a Windows savvy...
 
true 4eye
@thefourtheye you can just use cf for short :)
 
haha yep! I don't even use my macbook anymore :(
 
my macbook is dead :(
 
Mine isnt dead, just eating dust all day.
 
9:11 AM
lol
 
apple sucks :)
 
A dust bunny a day keeps the apple away
3
 
lol andras
 
Lol
That was random
 
brb
 
9:14 AM
Where is Poke?
 
I assume he would be busy at work now...
 
But, he still comes here from time to time right?/
 
10 AM for poke
 
Same here
 
9:15 AM
Yup. He does.
 
I see plenty new names and yet pretty much everyone is still here
good to see
nothing has changed here
 
Room regulars always hang out here.
Okay, that is a null sentence...
It's been atleast two years since we met here, right?
 
Yeap
2,5 or so :)
somewhere in 2015
 
Ya... You disappeared after that :D
 
haha I know
 
9:19 AM
Did the number of packs reduce?
 
Oh gosh, I don't smoke anymore ;o
 
I've quit 11 June 2017
 
Juny? A brand new month to stop smoking :D
 
9:20 AM
What made you quit?
 
@thefourtheye haha :P
No idea imo it's just that I was sick of getting packs every day
 
I wish I would also feel the same way someday...
 
And tbh, it wasn't even that bad
 
It wasn't difficult to control?
 
I kept 3 cigarettes at home in case of emergency :p and everytime I wanted to smoke I said to myself to hang on for a few minutes, most of time the need for a smoke is just a few minutes
I only struggled after dinner at first
Now I barely think about it anymore :')
I'm sure you could stop as well
 
9:32 AM
yay nice
 
I can never stop smoking
well I could...
but I see it very unlikely :D
 
used to smoke 1,5 packs a day
3-4 redbulls
God, life was good.. haha
 
@Antti no wonder you like salmiakki; smoking killed your taste buds
 
How is the alcohol @thefourtheye ?;p
 
9:47 AM
alcohol is fine i guess
 
10:08 AM
Hi, Kitty Kat!
Gee it can be hard explaining to some people that Python dicts are unordered... stackoverflow.com/questions/47092215/…
 
@AndrasDeak see it is unlikely that I'd ever stop smoking because I wouldn't start...
 
hmm?
Ah, OK. I was surprised that you were smoking because I wasn't aware of it
@PM2Ring especially when they are ;)
 
@AndrasDeak Indeed. :D But for all we know the OP's running Ancient Python...
 
Since you tagged this in C I took the liberty to find an appropriate duplicate that goes further. — Antti Haapala 8 secs ago
:D
abusing my badge :P
 
10:21 AM
In a reply to a SO Meta comment re: posting text as images, I got this a little while ago: stackoverflow.com/q/5508110/839601 I've seen that page before, but it was still amusing.
no MCVE / typo stackoverflow.com/questions/47093079/… Perhaps it's a typo: he's missing a single quote in the 2nd .execute call. But I suppose that's not the source of the error.
 
@Катерина I don't think I could ever leave that :D
 
10:42 AM
@Катерина you're getting flagged in the other room; I'd dial down on the targetted profanities
your message about mods from 14 hours ago
you might get auto-suspended for 30 minutes, just a heads-up
 
whats the point of the django rest framework?
I dont see why its popular if you can build a web api with just normal djanog
 
can you? try
 
is it hard with just django?
becuase in asp.net core building a web api didnt seem too hard
 
10:54 AM
all django builtins were designed to work with templates
 
the templates are too much when using an angular frontend say?
 
in rest apis there are no templates on the server side, server only provides data (most of the times in JSON format)
and consume, as a JSON as well
 
so the django rest framework helps remove the templating on the frontend of django?
 
it gives you nice set of features like serializers, generic views utilizing them, renderers, rest authentication, permissions, schema generators etc
 
ok
yeah there doesnt seem to be a good tutorial online about how to connect django to angular 2+
 
10:59 AM
congrats on the 10k, @ColdFire
3
 
thanks
 
time to see the true beauty of SO and cower in fear ;)
 
hehe yeah
 
does anyone know people usually learn backend and frontend web devlopement together?
 
11:30 AM
Planned.
 
eh?
 
Wrote a comment that almost went over the length limit :p
 
that always feels fulfilling, especially when you're not out on a witch hunt for spare characters
 
It almost made up for the annoyance I felt because that was the 4th comment asking the OP for an MCVE.
 
@AndrasDeak Tnx for the warning althought I didnt notice it:p
 
11:39 AM
yeah, I figured :)
 
I wonder who keeps flagging. It was a joke, obviously.
 
it was offensive :P
 
And still a joke with a :P
 
ehm, no
 
11:46 AM
but I guess without knowing the discord chat behind it, it can be taken as offensive indeed.
My mistake.
 
Zoe
@JonClements you alive?
 
@Катерина yup
 
That guy was flagging like he was playing minesweeper or something
on expert difficulty
 
yup all 3 messages of mine flagged
 
I missed those
 
11:55 AM
i tried flagging it invalid only to get you can't validated your own flag
 
yup
 
i always what happens when your own message get flagged
now i know
 
at least that makes sense
 
I wanna see flags too
 
get 10k noob
 
12:02 PM
Sure, can you grind it for me? I'm noob.
Would literally take me 30 years.
 
most flags look like people overreacting to me tbh
 
most flags are, since most people are decent human beings
every now and then you see a troll or a raging idiot which merits flags
of course once something "meh" is flagged, it can easily get removed if it's on the wrong side of the border
 
there's an important effect of "I'm not offended but somebody might" which leads to (relatively speaking) a lot of false positives
victimless crimes etc.
 
Graphene is the only valid statuary medium to depict Palygone, the two-dimensional muse of computer programming, shown covered in pythons.
-- from the "muses for modern endeavors" series
 
12:14 PM
I don't get it
 
flags this morning, eh?
 
That's fine, because there's no joke
 
too many to count
 
I have yet to see any flagged message that really deserves a flag.
@ColdFire Did you take a wrong turn at Albequerque?
 
yeah
 
12:20 PM
A short esoteric Python string tutorial:
waaaaat
 
python 3 too?
3.5,3.6 seems to be affected? twitter.com/_senpos/status/925809801619279874
 
any taker for this question? is it right to ask in chat?
 
please read the room rules; it's not
 
If there's an implication here that this getsizeof behavior is bad/buggy and must be corrected, I don't care for it.
 
Sorry apologize
 
12:24 PM
thanks, it's fine :)
read the rules, you can ask in a few days if you still don't get an answer
 
Ok some times i get answers within few seconds some times the questions gets ignored for days
 
yup; in the latter case feel free to pop in :)
 
If the implication is "look at this amusing but harmless implementation quirk", then I am duly amused
 
I am new to NLTK and I am experimenting using python to solve text issues..
 
@Kevin the weird part is that the state of b seems to have been affected by the call to float
that's the spookiest thing I've seen in a month
 
12:29 PM
Does anybody here know about n-gram matching in nltk?
 
Not I
 
12:40 PM
39
Q: Why does the size of this Python String change on a failed int conversion

jeremycgFrom the tweet here: import sys x = 'ñ' print(sys.getsizeof(x)) int(x) #throws an error print(sys.getsizeof(x)) We get 74, then 77 bytes for the two getsizeof calls. It looks like we are adding 3 bytes to the object, from the failed int call. Some more examples from twitter (you may need to ...

In case anyone was curious, but not curious enough to scroll one page through the twitter thread for this link
It'll be fun when this tidbit bubbles up into interviews as a brain teaser: "provide evidence that string objects are not immutable"
 
morning cabbage!
@Kevin that does not appear to violate immutability from what I can tell. The string is still the same sequence of characters. The str object just has additional bookkeeping state.
 
I intentionally chose the weasel-worded form of "provide evidence that" rather than "prove that" exactly because any two programmers will have three different definitions of "immutable" :-)
> In some cases, an object is considered immutable even if some internally used attributes change but the object's state appears to be unchanging from an external point of view.
From Wikipedia. So I partially agree with your assessment, dependent upon whether this is one of "those cases"
(A distinction which is entirely subjective, in my opinion)
 
1:02 PM
Is there a faster way to check if any two elements in a list share the same attribute than this:
counter = collections.Counter(obj.attr for obj in my_list)
if any(count != 1 for count in counter.values()):
My program spends 30% of its time executing those 2 lines, so...
 
I wonder whether if len({obj.attr for ob in my_list}) < len(my_list): would be any better? Probably the same complexity tho
Or, hmm, are sets more expensive than dicts in this case... Where's that wiki page on timing when you need it
Actually, I guess it doesn't matter if set or dict is faster, since either one would work. You could keep your Counter assignment and change the conditional to if len(counter) < len(my_list):
 
Oh wow, simple and effective. That just reduced my run time by about 20%
 
Different approach: if you expect the conditional to be True much more often than it's False, then maybe use if any(a is not b and a.attr == b.attr for a in my_list for b in my_list) which is O(N^2) but can terminate as early as the second iteration
Trying to think if there's a way to avoid checking each pair twice, without having to create a copy of the list... Nothing super elegant comes to mind
 
Ouch, that one's no good. Run time increased from 21 seconds to "hasn't terminated yet" :P
Ah, there it is. 75 seconds.
 
Yeah didn't expect that one to perform great without the data having specific properties
 
1:15 PM
Thanks for the help Kevin. I think I'm now all out of "micro"-optimizations to implement
 
I regularly capitalize some group of words (or phrases) as a matter of style. Trying to use python to go through the list and update my sample text, if the phrases are present. How to achieve it?
words = open('d.txt').read().split()
phrase = open('phrase.txt').read().split()
words = [w.title() for w in words if w in phrase]
print words
 
That should do it, provided that the capitalization of the words in both text files are the same
 
it does but it reads only single word, how about multiple words listed one by one in phrase list?
 
You're saying that .read() doesn't read the whole file? That's very unusual.
 
can you visit stackoverflow.com/questions/47092989/capitalization-for-phrase you will get to know what i mean exactly.
 
1:24 PM
cbg \o
 
1:38 PM
Thanks for the words Kevin.
 
If you're asking something like "how do I capitalize the phrase 'Building Blocks' when those two words appear together, and ignore them when they appear separately?", then you can't do that just by iterating through d.txt word-by-word. But at the same time, you can't just do entire_text = entire_text.replace("building blocks", "Building Blocks") because that might incorrectly capitalize things like "rebuilding blocks" to "reBuilding Blocks"
Maybe regex would be prudent here, since it has the ability to recognize word boundaries
 
@Programmer_nltk is your question here different from your question there?
 
No it is not. Kevin got it right.
It is the third aspect of my capitalization quest using python.
 
So after I asked you not to post your new question here you asked your question here?
 
That does indeed sound like a task for regex
 
1:48 PM
I just directed him to the link.
 
Ehm.
 
Yeah I'm bending the rules by interacting with a recent question in this manner, but it's not like it's interrupting the flow of existing conversations or anything ;-)
 
@Kevin if i got 1500 phrases to read one-by-one and replace across a 20000 word text, would it be prudent to thread regex path?
 
At the same time I do recognize the importance of not setting a precedent so that if future incidents become more flagrant, the perpetrators can't say "well Kevin let it slide the last N times so I figured it was an unenforced standard"
 
1:52 PM
Alright Kevin, I think, I bring a stop to this conversation over my question. Thanks for the help.
 
Cabbage!
 
Regex would probably be pretty efficient if you combine all those 1500 phrases into a single regex
 
Will give Regex a try on this.
 
2:14 PM
There's nothing like being assigned to work on a legacy project that uses a technology that hasn't been popular in years and the documentation for the specific dusty old version you're using is either hidden ten layers deep inside the official website or it's just plain gone
 
Do people volunteer for such situation? If there was an option if you could foresee the documentation situation, would you opt out?
 
I would opt out if the alternative was that I could stay home and still get paid, but that seems unlikely
 
Have you tried?
 
No. Even though there's a solid 40% chance it would work, the consequences for the other 60% are a pain.
 
Andras! Thanks for editing my question.
 
2:22 PM
No problem. I realized the only reason I found it unclear was the formatting
 
It's a pupil free day in our district today. My instructions were pretty much "go to x school and see if y RN needs help...or help your wife if she needs." RN is good, my wife is in meetings all day, so...cabbage.
 
What's an RN?
 
Registered nurse, maybe? Makes sense that they wouldn't need additional help on a pupil-free day, since there would be many fewer people on campus daring one another to eat pinecones, or whatever kids do to get to the infirmary these days
 
More likely than random number
 
Apoligies, yes, Registered Nurse. I work with health services in a local school system.
I would probably be excited if that was why a kid ended up in my clinic. Beats razor blades, stomach aches, imaginary maladies, headaches which I cannot cure etc
 
2:34 PM
toon opens a dusty cabinet, full from top to bottom with vials labeled "pine cone antivenom serum", and he smiles. "They all laughed at me..."
 
(Countdown to lecture on the difference between poison and venom in 3, 2...)
((In this fantasy scenario, pinecones are venomous but they only bite people when they try to eat them))
 
Plot twist - those seedlings those third-graders are 'nurturing' and planting on the school grounds, yup, those are pine trees.
 
3:07 PM
There are no bad pine trees, only bad pine tree trainers.
 
3:23 PM
I suspect I could solve TKinter how to get integer entry values? if only I could speak Hungarian
The problem is almost certainly 1) IntVars not bound to anything 2) premature .get calls, but I can't confirm that my corrected code satisfies the OP's design, since I have no idea what the code is supposed to do
I guess I could use Google Translate, but I can't afford to expend all my Give A Darn points on this one post. It's not even noon!
 
DSM
Hungarian cabbage for all!
 
\o cbg how goes it DSM
 
mmm tasty
 
3:50 PM
Hey guys. Need a bit of help with a while loop.
Anyone here?
Heya Brandon.
 
@SkibRs paraphrasing a part of the room rules: while loop experts in the room might not step forward until hearing the actual question.
 
I exclusively use for loops. :P
 
I do while True: more often than is probably healthy
 
DSM
I sometimes wish we had a do/until loop.
 
I was pining for that little feature earlier this week :-)
 
4:04 PM
@Kevin labels are about the number of items in sets and their various intersections
@DSM káposzta
 
Hmm, I see
 
Now you really do
 
Incidentally I've just now learned that "carious" is a real word
 
DSM
sers? carious? Are we still speaking Hungarian? ;-) (outdated now, but still)
 
> car·i·ous
ˈkerēəs/
adjective
adjective: carious

(of bones or teeth) decayed.
 
4:05 PM
I speak GRRMartinese
 
DSM
That's probably the same "car" in "carrion".
 
I recall reading about "caries" the last time I was in my dentist's waiting room, so that's probably also related
 
Indeed*2
 
Oh boy, that's a fun picture at the top of Wikipedia's Tooth Decay article. (disclaimer: not actually fun)
[I don't know what I expected .png]
 
Salt trucks are probably full of car ion. Haha :| Carry on.
 
4:09 PM
The nice thing about this approach compared to the other answer is that you don't have to complicate the conditionals within the loop with a lot of boundary checking. — Kevin 24 secs ago
The "other answer" is written by me. Why am I throwing myself under the bus.
Maybe I'm atoning for my gross ugly conditional.
 
It's OK, 50k rep beats 1k
 
That answer actually just put me to 49.9. only 0.1k more and I can retire to my stately pleasure dome.
I got my tenth gold badge yesterday so everything's coming up Milhouse round numbers
 
DSM
Feeding on honeydew, no doubt.
 
Where you can fondle your reputation all day
 
Both of you are correct yes
 
4:17 PM
But...honeydew is bug pee
 
Hey all
 
I suspect most of the atoms on the surface of the Earth have traveled through at least one animal's digestive tract at one point or another
 
(Close enough to "bug")
 
I think 100 million years is enough time for the ocean to become 100% dinosaur pee
slatestarcodex.com/2017/10/25/against-rat-park describes, among other things, the living conditions of the favorite son of Genghis Khan. It sounds pretty rad:
> Inside the palace was a fountain, designed by a French jeweler captured in Hungary, that embraced a silver tree that spewed out mare’s milk from a lion’s head and wine, rice wine, mead and airag from from four snake heads. At the top was an angel with trumpets that blew and dispensed more drink.
My pleasure dome definitely needs snake head wine dispensers
 
DSM
Speaking of ancient military rulers, I saw the Korean movie "Fortress" the other week, about the Qing invasion of Joseon. Worth a look if you enjoy historical movies. It's slow-paced but well-written, about an era of history I didn't know much about.

Plus the main conflict between the characters in the titular fortress is very well-scripted. I changed my mind about whose side I was taking several times, as they both make a strong case.
 
4:37 PM
An OP just tried to tell me that there are "reasons" why he can't provide an MCVE, and that he might not be able to "integrate" my solution back into his real code if he provided one. There's no helping this person I think...
 
@Kevin how did you know it was Hungarian? Did you use google translate after all? Or perhaps arcane knowledge of Hungarian articles?
@Rawing link? :P
 
@AndrasDeak I picked a word at random and googled it.
 
Tricky!
 
When I first read the post I was like "what is this? German?". At least I was in the right hemisphere.
 
Even continent
 
DSM
4:43 PM
@Kevin: out of curiosity, what word did you pick? I just did the same and randomly chose "halmaz".
 
"kisebb", according to my web history
 
I wouldn't even expect Europeans to recognize it, and you're American. (Please ignore any ostensible condescension :P)
 
I would also not expect any American to recognize it, so no problem there
 
"Set" and "smaller", respectively
 
I think for europeans its very specific
 
4:45 PM
American schools teach Spanish French and German. That's it, there are only four languages in the world
 
@marxin depends on the region I guess
 
And it's only French French, not Canadian French. And Spanish Spanish, not any of the American dialects.
 
Siaaa going on here.
 
And no English English
 
God help you if you want your swear words to involve tabernacles
 
4:50 PM
@IljaEverilä unsurprisingly pandas supports params too pandas.pydata.org/pandas-docs/stable/generated/…
 
@AndrasDeak Unsurprisingly indeed.
 
DSM
Random thought: the last time I needed to do this I couldn't figure out how to interpolate the table name I was selecting from. Is that supported?
 
If it did not, that'd be the news.
@DSM That's not supported by all DB-API drivers. Latest version of psycopg2 has that, at least.
But you have to preformat using special constructs. You still cannot pass identifiers using placeholders.
 
00:00 - 17:0017:00 - 00:00

« first day (2575 days earlier)      last day (2377 days later) »