« first day (2974 days earlier)      last day (2198 days later) » 

00:18
Is there any way to run a python script but continue in interactive mode
I dont like copy pasting lines from my code into interactive mode
wim
wim
00:32
back in aus we had these signs around the beach that say something like "if your dog does a crap please put it in the bin"
it always cracked me up because the way it was worded was like you were supposed to put the dog into the bin
01:02
Is that the Aussie Dog Binning algorithm? Very efficient.
cbg
finally finished today's AoC...whew
@ChuckIvan I've not heard of that one. They always have elaborate names. Care to share how it works? :P
Is there any reason for this to return false if the svg is in nthe same folder as the script? paste.pound-python.org/show/uLNrFqzhIW83Ab4pypgQ
I need to get out of reading AoC as "Age of Conan" ... even having never played the game, it has planted itself in my brain :/
@roganjosh I think Don Knuth wrote a paper on it. It's pretty straightforward. Let D be defined as the set of all dogs on the beach B. If any dog in D is seen taking a dump on B, remove that dog from the set D and place it into the set T, also known as the trash. Perform this as a loop until either T is full, D is empty, or B is closed.
3
01:12
^ sir, have a biscuit for that :)
Rbrb all
01:30
@roganjosh
I'm jealous of your portal cube auto-gen avatar
no one knows how to do that?
01:44
Can you achieve the same result by using the input() function in a loop then parsing the argument?
What kinds of interactions are you looking to make with the script while it's running
@ex080
Well I want to incrementally build my code. I know lines 1-100 work but I dont want to run 1-100 everytime I want to test something. I like how in the interpreter interactive I can just redo the steps I want without having to rerun everything.
Oh cool. Maybe you could have two shells open, and when a command works you copy it and pipe it to write to file. That's just one idea.
For example:
In a unix system:
line = The most recent line of code you successfully ran in the Python interpreter
In other shell:

> touch file.py
> echo line >> file.py
the line will be appended to the python file. Sorry for breaking up the answer
oh ok thanks
Yeah basically in a Unix system (Mac, Linux) if you have a python file and you want to add a line to it but you're stuck in terminal you can append a line of code to that file by running: echo [some line of code] >> [file.py]. Hope that helps.
And you can have multiple tabs of your command line open to make the workflow really simple.
terminal*
01:59
ill try that
02:18
@ex080 Make sure you include tabs!
02:51
cbg
is there anyone used pytest before?
03:15
cabbage
How do we test WebSocket by use Pytest+ tavern?
03:31
you mock your dependencies and grit your teeth for the long haul
04:21
lol, I think you did
04:32
@coldspeed my updated answer to that question: df.apply(pd.Series.idxmax, axis=1). Ready to argue about it for the next hour?
7 hours ago, by coldspeed
welp, that's my quota of "politely disagreeing with people on the internet" met for the day
:P
wait till 12am
Darn, might not be up that late, I'll get back to you tomorrow morning :P
by then my quota might be exhausted again XP
done
ah my (internet) bad, I think that "done" took some time to send
05:37
advent of edge cases.
i.e. that wasn't fun
wim
wim
06:03
@AnttiHaapala really? my favourite so far!
06:27
@wim how many submissions?
hey is it ok to ask a question about django here?
@Gary it is more ok than asking whether it is ok to ask ;)
ok thanks!
An app works locally and is being deployed, however this line...
` created_mangopay_wallet, response = client.wallets.Create(mangopay_wallet)
is generating TypeError wallet not iterable
should this be httpresponse because it's over the web now? or any other thing obviously wrong here?
06:50
well that song makes me want to sing or drink or both
no truer words ever spoken
wim
wim
07:19
@AnttiHaapala no errors! I did make 1 bad submit on part A because I accidentally forgot to change test data back into real data, but it was more a dumb mistake than an edge case
I was using the automated submission and ran the script but it submit the answer for the test case, whoops :D 60 seconds penalty
@AndrasDeak huh, well, I didn't flag it if that's what you were thinking.
07:31
@wim I did
I didn't run into edge cases either. But the +-60 secs in the examples confused the hell out of me
I actually didn't have any issues with edge cases on mine
It was a bit of a pain to actually get part 2 done
mostly just trying to wrap my head around it
my solution is heckin gross
Same here
But I've got work early today so I didn't have time to be smart about it :)
Yeah, I have an interview \o/
wim
wim
08:10
@AndrasDeak weird, I thought you were disagreeing that it should be deleted
09:09
14 hours ago, by Andras Deak
I'm not saying we shouldn't delete it. I'm saying it shouldn't cost 200 rep to the answerer
Splat comprehension, reading comprehension :P
Did anyone have solution for this
DatabaseError: ODBC error
state: 28000
native error code: 18456
message: [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Login failed for user
I think I'd focus on this part of the error "Login failed for user"
Try verifying the login credentials (and method) in various ways
my friend can access the DB using same code but i can't
re-cabbage -
Luckily, all the elves are working at the same pace... Still wrestling with this!
09:42
@ReblochonMasque I finished right now.. I needed 4 submissions for the second task :|
haha, well done @Arne !
I think the coding for today was a lot of fun, if a little tedious. At least i was lucky and didn't have to fiddle too much with off-by-one stuff, just mixing test- and submission-settings.
(I use Windows) I just found out that the python path that I use for Anaconda is not the same as the python path that I use for cmd; is this something I should change?
09:59
@alphacapture If you want you code execution to behave consistently, then yes.
But I'm not on windows, so I wouldn't know how to manage envs
Oh, just in case I wasn't clear, the environment should be set project-specific. You don't want one and the same python environment for all projects on your workstation.
Is there any reason to prefer changing one path vs the other? Right now my cmd python is in (a few folders nested within) my user's %APPDATA% folder, while my anaconda python directly in the folder containing all of anaconda3.
10:15
Can I request a dupe on this question? The duplicate link is stackoverflow.com/questions/36538780/….
The revision history shows the user who answered this question reopened it without discussion or notification.
@alphacapture I can't say for sure if it's different on windows, but what you say doesn't make sense to me. Do you know about virtual environment handling?
@Arne I've used anaconda environments before, but I'm not that familiar with it
Hola! Does anyone know how to create a type with typing that can be one of two str values, for example, only 'Cats' or only 'Dogs'. Something like: T = TypeVar('T', 'Cats', 'Dogs') except that this won't work because ```TypeVar`` requires type args.
You can't, because neither "Cats" nor "Dogs" is a type. They're values.
10:21
^
maybe you actually need an enum, but it's hard to say
@Aran-Fey Yup. That is why I am asking. I could not figure out from the docs.
hi anyone here that use django-allauth provider with Facebook?
@Arne aha yes I think that would make a better dupe :)
I was a little hesitant as first because of how many upvotes the to-be-duplicate has
Reasonable hesitation, but that one is imo a better target. Maybe wait for someone like PiR to give an opinion that is both unbiased and knowledgeable
Sounds fair.
11:52
Feb 7 '17 at 11:48, by PM 2Ring
Welcome @JibinMathew Please read our room rules. You may not link your fresh questions from SO here, you need to wait a day or two.
@coldspeed Gone
@AnttiHaapala Those comments should probably be moved into a chat...
Has anyone here had bad experiences with pbr? I have to talk to colleagues in an hour and am collecting reasons in favor of banning it.
12:38
recbg
so damn cold here
I brought my wife's laptop with me so I can drop it off for annual maintenance. Decided not to squeeze my sweater in my bag next to it...bad call
sending warm cbg then :)
thanks ;)
outside it's fine because I've got a nice warm coat
13:31
That awkward moment when the OP picks the worst answer out of the bunch and resigns themselves to copy/pasting error-prone code hundreds of times :/ stackoverflow.com/questions/53670209/…
is it actionable?
No, just frustrating
I think the OP just saw an answer that didn't introduce another library and it closely resembled their initial attempt
pro-tip: [edit] in a comment expands to an edit link of the same question. Quite handy for educating noobs
Putting the questions aside, is much being said about the answers that are coming out recently? I suspect the effect I mentioned actually does exist; new coder sees broken answer that resembles their initial code so they take that on the assumption it's correct.
13:51
I think their reason for picking those answers is a different one - it's probably just easier to integrate into their code, since the code is similar
But it doesn't do what they asked for which is to repeat for hundreds of files
just a general observation, I didn't actually look at that specific question
14:06
Something has gone really wonky with my mobile view on the upvote comment button. It seems that some are randomly highlighted in blue even though I didn't press it, and it doesn't seem to have any pattern to which comments have it that I can see
14:25
@AndrasDeak huh, I misread this the first time. Thanks for that, I will definitely make use of it
14:35
@roganjosh We could try harder to write answers that do not impose as much of a burden of knowledge
Or did I read your question incorrectly?
A mixture of both. I agree with you that there is an issue of people jumping to things like itertools for newbie questions which is nonsensical IMO unless you prepend a solution they could hope to grasp. The other part of my question though is that there's all this fuss about low quality questions but I'm increasingly seeing very poor answers coming out
And I think they actually carry more weight in terms of issues for SO than the noise of poor questions
A bad answer, once accepted, is difficult to deal with, especially if the poster isn't all that invested to respond to feedback
\o cbg
Cbg mooing
14:52
@roganjosh Hmm, I didn't see more bad answers than usual. If I do, I'll do my part and be easier with the downvotes =)
The last couple of weeks put me on the main feed for an unhealthy amount of time while twiddling my thumbs. Thankfully I've finished debugging the long-running parts so I'm kept busy again :)
15:04
cbg
It just occurred to me that since implementing pathlib instead of strings for filepaths in my app, I am now using Path objects as dictionary keys. Assuming I'm not planning on altering those Path objects during the runtime, is this something that could end up biting me in the butt, or is it just in general a bad idea?
Or am I fine? lol
any numpy / scipy experts that want to shoot holes in my AoC solution for yesterday? :-)
15:21
@roganjosh I appreciated being enlightened about such features, even when I was (more of) a newbie. There's a difference in saying 'use this itertools function' and 'here's how you do xyz by hand, which is pretty much what this itertools function does, but itertools is more efficient' - but to me that's the difference between a functional answer for the OP to drop into their code, and a good/complete answer on SO which benefits the community and educates OP rather than simply fixing OP's issue.
Yes, please don't think I was suggesting that you shouldn't be showing (potentially radically) different approaches, but there are people that literally just dump those and move on. The best approach would be to give something that you hope is comprehensible for their level and then give the alternate approach so that they can follow up if they choose
@toonarmycaptain it's probably not outrageous to say that 90% of my knowledge originates from SO exactly through that approach, either to my questions or in good answers to others. It always prompts me to follow up with my own research.
@roganjosh Indeed!
15:37
hi, say i have a string which has date and number in it, and a list of strings (len 100), now what i am trying is to find which among the list of strings is the best match for that..(not in terms of date and number but what it represents).. i have looked at nlp but its very broad for me (n i am new to this)..can anyone point me in the right..thanks direction..thanks
n8_
n8_
Good morning! Quick question....is it possible to write "age_df = df.columns[df.columns.str.startswith('AgeAt')]" but add "and not endswith('Flag')"? I've tried "age_df = df.columns[df.columns.str.startswith('AgeAt') and not df.columns.str.endswith('Flag')]" but get a ValueError
Phone-coding-challenge accepted!
age_df = df.columns[(df.columns.str.startswith('AgeAt')) & (~df.columns.str.endswith('Flag'))]. Does that work?
n8_
n8_
That worked, thanks!
What does the tilde do?
Negates the condition. So we're saying "not" this condition
n8_
n8_
15:50
ah gotcha
A general, but related, point. If you think .str methods in pandas are vectorized, they're not. I have seen a few cases now where list comprehensions run faster. I don't know whether speed is a concern but keep it in mind.
@roganjosh hey can you help with my ques.. ?
@iamklaus if I thought I could, I would have had a go by now :) Even when the room is quiet, during peak hours, plenty of people will be paying good attention to what is asked
@roganjosh ahh my bad..wasn't aware of that.. thanks anyway
@iamklaus you have to start by defining what "best match" means.
15:58
:)
@Code-Apprentice two sentences written different way but they have similiar meaning
and what does that have to do with the date and the number?
so date and number can be different like reporting some data..
with 75 users currently talking in 38 rooms or there are 75 users but only 38 are currently talking :)
I really don't understand what you are asking. I suggest that you take some time to think through your problem and figure out how to explain it to others in a clearer way.
It sounds like your question actually has nothing to do with the date and number you mentioned but more about determining the meaning of two sentences.
It's just not helpful for people to say "no, sorry, I can't help" but it doesn't mean the question is ignored. In this case you should look into providing an MCVE because, while the answer is probably outside of my field, I also don't properly understand the question
so "I have a string which has date and number in it" is an irrelevant detail that doesn't help in explaining the question.
16:06
@Code-Apprentice @roganjosh okay i will look more into it and get back.. thanks for looking :)
n8_
n8_
16:24
If anyone is good with pandas, can you please check out stackoverflow.com/questions/53659027/…
Been bashing my head against the wall for days!
@n8_ You already have multiple answers, one of which is from coldspeed that you've only just replied to
n8_
n8_
I know, as I said in my post, they do not work.
I just edited my post
Im close but just need some fine tuning
Ok, so give him and the others chance to adapt :) I didn't look at the other names that posted but he's very good with pandas
n8_
n8_
ah ok
Yeah, he's helped a lot
16:46
PyCharm just taught me I could do chained comparisons eg if x- 5 < y <= x+ 5: instead of if x-5 < y and y <= x+5:
@toonarmycaptain wasn't it you that had issues with auto indentation? Pycharm giveth and taketh away
@roganjosh It was me you're referring too, but the issue was with me rather than autoindent.
Oh. Pycharm giveth, then, I guess
17:19
Re typehints and default arguments does anyone prefer `def function(x: int, y: int=7): `
over `def function(x: int, y: int = 7): `
I prefer the former but I'm seeing some linters, not.
17:34
@toonarmycaptain what's the difference?
oh...spaces
I think the additional whitespace isn't helpful visually, and given that the usual format without the type hint doesn't use spaces, I wondered if my opinion was shared.
I have not yet used type annotations, so I don't have an opinion
Is there a pep8?
@toonarmycaptain I concur with your view - no spaces
17:55
@Code-Apprentice Not as far as I can see. PEP8 refers to PEP484, which as a section with an example but the example is for arbitrary argument lists and unspecified default values which isn't exactly a general use-case.
I'd also prefer `def greeting(name: str): -> str` to `def greeting(name: str) -> str:`
with the type hint after the colon, but I haven't played with typing return values yet.
18:13
Is there a specific term for the key parameter to things like sorted? A function parameter that expects a (anonymous) function.
18:24
@roganjosh key expects a function. It does not care if it comes from def or lambda
Yep, hence why I put in brackets. I wondered whether it had a technical name, as opposed to an argument that expects something other than a function
But to answer your question. I don't know of a name for a parameter that expects a function. Why are you looking for such a term?
Unless I'm bein very naive in my thoughts on a Friday, pretty much every other type of argument is to be operated on rather than being being used to operate on something else
FWIW, sorted() itself is a higher order function because it takes a function as a parameter
@Code-Apprentice curiosity alone
18:45
@piRSquared Does it make sense to close stackoverflow.com/questions/40468069/… as a duplicate of stackoverflow.com/questions/53645882/pandas-merging-101? The difference in votes is quite large, but looking at it, this is an obvious duplicate, and I have closed many similar smaller questions as duplicates in the same way
I'm afraid if I continue to close large questions like this, I'll keep receiving more knee jerk reactions like this and this, followed by more mindless downvoting.
wim
wim
@Arne Yes. Avoid.
It doesn't even package itself correctly.
Use a more modern tool such as poetry or flit
@coldspeed it makes sense... however I'd predict exactly what you're afraid of.
I would like to think that being the 10th top user of all time in the tag gives some credit to the actions I take in this tag, but not everyone would share the same opinion
And I can see yours already has a close vote
wim
wim
disclaimer: last used Dec 2017, it's possible they got better and fixed bugs since then (but tbh it didn't have much features over setuptools anyway)
18:49
Yeah, I think it does. But when you affect another top user, they will make their own justifications. It is human nature.
@piRSquared yes, by one user who happened to be the OP of one of the other larger posts I closed (this one). The contents of the answer here are in my canon as well. But I'm having second thoughts. Did this closure make sense?
lemme see
wim
wim
@toonarmycaptain Pathlib objs are immutable, so you should be fine there.
Again, high probability match. Not perfect, but it makes sense as a dup. That said, you still have to decide if you want the headache. Maybe you're ok with it (the headache that is) but the headache will come.
wim
wim
@MartijnPieters some of us were looking at it last night. Very beautiful, nice work Martijn !
@toonarmycaptain you can't polish a turd
better: def function(x, y=7):
18:56
@piRSquared Thanks again. I would assume the same thing applies here—merge and concat have been discussed extensively in your canonical and mine.
n8_
n8_
hey @coldspeed, I edited my post from yesterday in case you want to take another stab at it.
wim
wim
but seriously, if you want to use the hinting at all then just blacken your code and focus on more important things than code formatting style
@MartijnPieters Seconded I will show your work to my colleagues.
(sorry, that was the wrong link, fixed)
wim
wim
@coldspeed closing well upvoted year old question as a dupe of one you wrote yesterday seems gratuitous to me. avoid.
"Related: " comment is OK though.
19:02
@wim that sounds like a good strategy. @coldspeed even more, send me a list of such comments and I could upvote them to help pin them.
I've always found it funny how the line is drawn based solely on the number of upvotes even though meta explicitly encourages it it most threads I've seen: case 1, case 2 (by @wim, actually), case 3 on MSE; while this one suggests seeking input.
wim
wim
not "solely".
it's a factor, because it correlates strongly with quality.
n8_
n8_
who determines quality? wouldn't that be through votes?
It is and always will be one big fat fuzzy mess. We'll be more successful navigating these issues by recognizing that we are all human and behave as such. Expecting everyone else to respect a set of rules that we think are right will only encourage resentment.
wim
wim
I guess that's hard to define accurately, and may be also subjective. But when I'm determining quality I'm thinking "does it work? even with edge cases? is it readable and easily understandable? is it making good use of the readily available stdlib or 3rd party tools?"
19:14
I came across some 100 questions yesterday that were merge questions, and about 20% of them were asking for minor variations or additions, like cleaning up columns, dropping duplicates, or some kind of aggregation after. I did not close any of them. Only ones that were fully covered by cases in my post have been hammered.
@wim does poetry feel stable? It is really young, and undergoing lots of changes in short time.
I did a lot of similar such cleaning up on pivot questions last year after piR's pivot canonical had come out. I guess it's not so much a conflict of interest if someone else besides the OP does it :D
It is identical work. But perception is different for sure.
@Arne I have the same question. After seeing it, I wanted to jump right in. But I'm afraid of wasting my time and effort. If it is a high probability of being a robust and stable way to package, I'm all in.
And @wim are we still waiting for packaging cannonical (-:
wim
wim
19:30
@Arne Fair question - I think you'll be ok, since Poetry uses the standard pyproject.toml file to replace the usual bunch of junk files. See PEP 518.
It does use a custom [tool.poetry] section in that file, which would mean you can not trivially switch to a different packaging app, but I don't see that as a massive deal breaker.
I enjoy using that piR question as a dup. It's one of the most comprehensive answers I've seen on the pandas tag. (And questions about pivoting come up so frequently)
thank you @ALollz that is kind of you to say.
But I'm always surprised at how difficult it is to find good duplicates for seemingly simply and frequently asked questions. Yesterday it took me about 10 minutes to find a duplicate for someone wanting to just .groupby().cumcount(), and I felt like the one I found was far from being the best post to tag.
What exactly affects google indexing here? I've never seen that coldspeed answer, and I always struggle to find PiR's canonical. It seems that the age of the post wins over recent activity?
19:53
good question. idk.
@user2357112 stackoverflow.com/questions/53676034/… you can use exit without a function call?
@piRSquared cool, thanks for the input. I really appreciate it.
I'll include it the next time the packaging discussion flares up with 'the SO bigwigs say pbr is bad'. That should put it to rest. =)
I'm still at a loss as to what that code is supposed to do, though
The best I can think is that whoever wrote it intended break, but even that seems pointless in the loop. It's not easy to search :/
20:11
@roganjosh: exit doesn't work that way normally, but it does in IPython.
@user2357112 I made that comment when you dupe hammered it :)
It was a semi-question about whether the dupe was appropriate because I didn't see the connection. The IPython behaviour is actually a bit odd to me.
@toonarmycaptain in case it wasn't said already, pep8 says to put whitespaces around type hinted default assignments. So the linters are correct.
@wim just noticed my phone messed up this ping, that appreciation was directed at you.
20:45
... can moderators edit comments?
No, just move
I 99% don't believe it
I could swear to god I've just had "Not intending to sound rude" removed from a comment suggesting the OP read tutorials on working with files, and that part is gone
Within 30 seconds
And the question was also closed by a mod
Oh, i thought you meant in chat
I have no clue about the main site
And I know it's noise, but since I've been warned about being rude, I now caveat stuff
But being warned about being rude and then getting caveats about my actual intentions also removed by mods.... unless I've hallucinated what happened here, that isn't right.
No, i guess you're right. There is no reason why they shouldn't be able to do so, and over there they do provide features people ask for.
20:56
Mmm, I'll put this first instance down to a hallucination :)
@roganjosh the welcoming wagon retrospective was quite interesting in that regard, with how new users actually see very little issue with rudeness as it is perceived by SO staff
@Arne absolutely! Let me find the comment that I had in my head while reading
Though I don't really dispute my rudeness flag overall, there was a week where I had a lot of pressure and I probably did take it out on poor answers.
wim
wim
I'm certain moderators can edit other users comments in chat. I don't know if they can on main, but I would presume so
21:42
they can
@AndrasDeak for the main site?
Ok, then I absolutely don't know the goalposts
the bottom line is that comments can have anything happen to them whenever
a different mod would have deleted your comment if it had a flag on it
again a different mod would've left it alone
I don't actually blame the mods
21:47
me neither
We all seem to be struggling round the same concept
22:03
Finally got round to looking at Martijn's offering to tear holes in. It's a little crushing when the guy makes out he doesn't know the library and still produces that kinda code :P
The threshold on "doesn't know" is a bit different (-:
No kidding :)
22:34
Got my new phone \o/
Just about done settling in
Are you taking it for a spin on python chat right now? :)
I am trying to create Logging for flask, where App is using Gunicorn to run Flask app and wrapping all things inside Docker container.
@arshpreet Are you following this up with a question?
22:52
@roganjosh yeah, posted that from mobile
@AndrasDeak speedy enough? How do the controls feel?
@arshpreet what is your question?
@roganjosh yup, nice and smooth
I need to know if there is good way to write logs in for Flask app at each component level, Right now there is this functionality available but does not seem to do work well: dpaste.com/2E6EZ6Z
I wanted to advance my pathetic new car analogy further but I think I should stop
@arshpreet That still isn't a question. You haven't detailed what exactly is wrong for you in that code
1. I am not able to understand
how it works
23:02
^ not a question
2. Not getting idea how span is being used to get logs
Anyway, I'm backing out of that discussion because it's only going to come across as me pulling teeth from you. Stating problems, and not asking questions, just makes things a bit difficult because I honestly don't know what to suggest in this case. I find logging quite complicated/unintuitive, I guess, so this will probably only serve to confuse me more.
wim
wim
23:21
@AndrasDeak except downvoted. they're immune from that. 😒
you can flag them if they offend you :P
wim
wim
@roganjosh you can tell he doesn't know numpy because the code is still readable
23:33
@wim this is true. I've got some Divakar code adapted in my codebase and, well, ...

« first day (2974 days earlier)      last day (2198 days later) »