« first day (2720 days earlier)      last day (2227 days later) » 
00:00 - 16:0016:00 - 00:00

12:29 AM
That awkward moment when a company whose job offer you just declined is like "NO, WE REALLY WANT YOU, WHAT WILL IT TAKE?!"
 
@JGrindal The one who didn't like your service dog?
 
@cᴏʟᴅsᴘᴇᴇᴅ yup
 
¯\_(ツ)_/¯
 
Basically.
 
@JGrindal ask for shitload of money?
 
12:40 AM
@Prateek Even a shitload of money isn't worth awful working conditions to me.
I made that trade a few years ago and it landed me in the hospital (and necessitates my need for a service dog today)
 
yeah.that sucks..and I thought service dog was metaphor for some software you built
nevermind..got it
 
If you, as a company, show such disregard for your people that you're unwilling to accommodate something that makes your employee's like significantly better (at no expense to you) just because its different, I'd rather just straight up not work for you.
 
Yeah. I here you. If you cant work without it , then they dont support your work freedom then makes no sense
 
@Prateek imgur.com/a/k95so nope, physical doggo trained to monitor me for panic attacks.
 
ohk.thats what I mean, I dint feel like asking if you have some special condition though. Hope you get employer who appreciate your necessity
 
12:48 AM
Yup, a different job offer. Last week, I got 3 job offers.... One was not a good fit, but there were 2 that were really close and it was a hard decision until one said "we don't allow dogs, not even service animals." so I said "OK, thanks for your consideration!"
So I went with the 3rd offer.
I'm gonna be a Senior Developer on a greenfield project, which is a little terrifying, but really exciting too!
 
ohk.cool
congrats!
 
tyty
I blame @cᴏʟᴅsᴘᴇᴇᴅ.
 
LOL.why?
 
He was the first person to ever tell me cabbage
 
12:51 AM
You was.
 
Lucky cabbage to you then :D
 
I remember because I spent like 10 minutes trying to figure out how to @ you.
 
whats cabbage mean as slang here?
 
@Prateek "hello" (or anything else that it needs to mean) - sopython.com/salad
 
@Prateek It's a bad word, don't use it.
 
12:56 AM
LOL..yeah..gotcha.
 
@JGrindal I usually tell them I've made up my mind, and they'd have to offer [something patently ridiculous] to get me to reconsider. But this last time, two companies I turned down actually made the ridiculous offer. That's even more awkward.
Although for a different kind of person than us, I don't think any of this would be awkward at all, but rather an opportunity to boost their ego and/or salary with a bidding war.
 
A few years ago, I was working as a consultant. I spent 271 days traveling. I spent more time in China than in the US. It was hell on earth, and it pushed me past my breaking point. That year, though, I made more money than I made in the first 5 years of my career combined. At the end of the day I asked myself "was it worth it?" and the answer was a resounding "YAM no"
 
1:36 AM
I hate writing emails. I can imagine situations like those would require a lot of emails back and forth
I also hate travelling. I mean, I enjoy visiting other countries for whatever reasons, but the plane ride there kills me
Jan 5 at 23:47, by cᴏʟᴅsᴘᴇᴇᴅ
Speaking of legs, I can't feel either of them
 
2:15 AM
@cᴏʟᴅsᴘᴇᴇᴅ Try being 6'7" and flying coach.
it's like hell, but with more smalltalk.
 
Isn't hell but with more smalltalk the original motto of Objective C?
 
2:32 AM
Aren't a lot of python's features inspired by Smalltalk?
@JGrindal Well, good thing I'm Asian, we never get that tall
 
3:31 AM
Yeah, Python's original OO design is definitely more Smalltalk-style than Simula-style, and some of the later features (metaclasses, hookable message send via __getattr__, descriptors, etc.) are directly lifted from Smalltalk. But I wouldn't call tacking Smalltalk onto a friendly scripting language hell. ObjC, on the other hand, sometimes feels like someone mixed up code from two different languages in your IDE.
 
 
3 hours later…
6:14 AM
Morning cbg
 
Morning cbg
 
cbg
 
@IljaEverilä I appreciate your timezone sensitivity
 
*insert unknown feeling* how election stats (visitors who vote, etc.) keep declining each year - stackoverflow.com/election
 
6:23 AM
I'm an epitome of PC (not really).
 
tbh I don't even know about election thingy? lol
I am so busy asking questions
 
@kanishktanwar They do ping you (SO inbox) and there's a black header at the top on the site during elections. Pretty hard to miss.
But, if you aren't aware of it, then perhaps it's easier to get ignored.
 
6:38 AM
I did not get any notification perhaps I have missed it
I will keep an eye on, next time
 
7:07 AM
I am trying to write an if condition, if the time is between 10:30 to 16:30. I can do time(10,30) <= now.time() <= time(16,30) but 10:30 and 16:30 are to be taken from a dictionary , which may or may not have a time. If there is no time this condition is always true. What would be an elegent way. mydict.get(time1,TRUE), mydict.get(teme2,TRUE). Basically i am trying to give a value which returns true if times were not given in mydict
 
@pythonRcpp time.min and time.max might be of use as defaults.
 
something like
if isinstance (mydict.get(time1, True), bool) or isinstance(mydict.get(time2, True), bool):
return True
# Do your thing
I can't seem to indent the code properly in chat
 
In that case why not just if time1 not in mydict or ..., though that'll do the wrong thing anyway; now.time() might be over the upper limit, even if the lower limit is not given.
 
^This
is much better
 
What I meant with min and max is: mydict.get(time1, time.min) <= now.time() <= mydict.get(teme2, time.max).
 
7:25 AM
@IljaEverilä Ohh you used time.min that is the least possible time !!! nice
 
7:42 AM
morning cbg o/
 
I created this big a def for such a small task. pastebin.com/0JZ0Gq1q
 
Cabbage guys
I was looking for a switch/case replacement in python
1306
Q: Replacements for switch statement in Python?

Michael SchneiderI want to write a function in Python that returns different fixed values based on the value of an input index. In other languages I would use a switch or case statement, but Python does not appear to have a switch statement. What are the recommended Python solutions in this scenario?

 
7:58 AM
cbg
 
The above question answers it
But the first solution though looking simple has got me confused
Can someone explain whats going on there?
Okay.. I got it another guys puts it in a function
I am an IDIOT!
wasted so much time on this, I am Hopeless!!
 
@AndyK cbg Andy!
 
@AshishNitinPatil hey Ashish
 
8:20 AM
Cbg
 
@RobertGrant o\
 
 
1 hour later…
9:38 AM
what could be a good way to write case insensitive key search. basically mydict.get("key",0) to get value from any Key,KEY,keY (if none exist then return 0 as default value)
 
@pythonRcpp Make sure your keys are always upper or lower case.
 
9:55 AM
Hello
 
Hello @pizz
I'm new in here, but have a done quite few projects in Python though
 
Sam
10:27 AM
@WayneWerner Will you give me a ping when you're active
 
10:40 AM
@Ajit see sopython.com/wiki/… and the link to the sandbox therein
@ChaitanyaTetali welcome :)
@Sam you could spare one round of international ping if you write down what you want, so Wayne can read it along with your ping
 
Sam
Fair enough
I want to gauge his opinion on using a memory store (such as Redis) for modelling a state machine simulation. I've read an article on someone using it but I'm unsure if it's a bit overkill.. I've looked at the State pattern but have a few concerns with it
I suppose its a universal question :)
 
11:07 AM
Best way to read and perform operations on large txt file? thinking of joblib. What would you suggest?
 
What kind of "operations" ?
 
parts of speech tagging, tokenization
 
Hehe, just noticed a downvote from yesterday on a 1.5-year-old answer of mine; accepted and no rival answers...
Tim should watch better where he puts his keys
FWIW it's not a very good answer, but I'd expect a legit downvoter to leave a comment that I'm dumb
 
jjj
Who is Tim?
An old foe of yours? :)
 
11:13 AM
@JonClements parts of speech tagging, tokenization
 
jjj
@AndrasDeak lol, the complexity of SO subculture. Btw congrats on becoming a RO
 
thanks
 
Hello Everyone!
 
hello
 
I had asked a question yesterday on SO, after working on it and discussing with my friend, I found the answer. Can I put the answer to my own qus. on SO?
 
11:17 AM
Of course, you're even encouraged to do so :)
Just make it as complete and clear as you'd do with any other answer.
 
Yeah! Thanks. I'll do that
 
You can even accept your own answers 2 days after posting the question, but you won't get any rep for that. Still, it can signal that the problem is solved.
 
Yeah! it's okay if I don't get reputation.
Thanks again
Have a good day ahead
 
no problem, you too
 
11:37 AM
Guys.. I found something weird in python
 
shoot
 
Lists work differently in command prompt and IDLE
 
No. Using print is different than not using print.
 
Same code when typed in command prompt works as expected but in IDLE shoes different output
 
30
Q: Why do backslashes appear twice?

Zero PiraeusWhen I create a string containing backslashes, they get duplicated: >>> my_string = "why\does\it\happen?" >>> my_string 'why\\does\\it\\happen?' Why?

 
11:42 AM
██╗    ██╗██╗  ██╗██╗   ██╗    ██╗██████╗
██║    ██║██║  ██║╚██╗ ██╔╝    ██║╚════██╗
██║ █╗ ██║███████║ ╚████╔╝     ██║  ▄███╔╝
██║███╗██║██╔══██║  ╚██╔╝      ╚═╝  ▀▀══╝
╚███╔███╔╝██║  ██║   ██║       ██╗  ██╗
 ╚══╝╚══╝ ╚═╝  ╚═╝   ╚═╝       ╚═╝  ╚═╝
That's nicer :p
 
Hmm repr() Can someone explain in dummy words..
documentation too complex
 
Perhaps learn to read documentation?
I mean, it will pay off greatly, if you take the time to do it.
 
How do you guys understand it.. Its sooo complicated
 
Basically, repr(obj) is supposed to give you a piece of text that you can paste into your python program without getting a syntax error.
´>>> obj = 'foo\nbar'
>>> print(obj)
foo
bar
>>> print(repr(obj))
'foo\nbar'
>>> 'foo\nbar' # it's a valid python object
'foo\nbar'
 
excess forward tick (?!)
 
11:55 AM
huh, I just noticed. Not sure how that happened
 
you dun goofed
 
I don't even know which key I have to press to get that character
 
it's altgr+9 on a Hungarian keyboard if that helps :P
 
cbg
I'm currently running some tests with pytest and I'm curious if there is some way to see what logging output is generated by a unit test? I'm not having a lot of luck searching for this
 
12:10 PM
@shuttle87 AFAIK pytest automatically captures all output and displays it if a test fails, no?
 
Sorry should have mentioned I wanted to see what happens on a passing test
 
Hmm... add assert False at the end? :D
 
user9552093
hi
 
hello
 
morning cabbage, first day of the new job \o/
@shuttle87 there's some way to make it noisy, but I can't remember what it is
 
12:28 PM
@Wayne and you're already slacking off in chat - awesome :p
 
Prepping for the day anyway ;)
 
perhaps related to my other issue, there's multiple places where there's a call to logging.config.fileConfig, am I right in thinking that this should be set up only once?
 
oh yeah, you should most certainly only be configuring your logging at one place
and that place should be, or called from your entrypoint into your program
 
I seem to remember something about fileConfig disabling existing loggers
 
everything else should just have something like this at the top of your program
import logging
logger = logging.getLogger(__name__)
 
12:30 PM
Right that's exactly what I've been doing. So I'm in the process of improving some code and making a library from it, I'm thinking that the call to fileConfig just goes in the top level __init__.py is this reasonable?
 
Do you want to make it a library that you can also run?
Because what I do is add an entrypoint to my setup.py
 
@WayneWerner I don't think it will be run directly, there's no script entry points right now
 
But that may change
 
if you're not going to run it directly then you probably shouldn't be setting up the logging in your library at all
unless that's literally its job
in which case it should be setup on whatever the function/class entrypoint to your library is
 
12:34 PM
oh right I see what you are saying
Ah right so I see why this is in here now, there was a script that ran things before this refactoring into the library
Thanks for pointing that out, going to change that.
 
Does python have any "singletons" (in lack of a better word) besides None, NotImplemented and ...?
 
I didn't know NotImplemented was a singleton
None is the only one that I'm aware of
arguably the only one that matters
 
it has its own class and everything
>>> type(NotImplemented)
<class 'NotImplementedType'>
 
You can create your own, but... I've never done that
*had a need
 
Ned said True and False seem to be singletons with a link to python 2 docs
same remark in python 3 docs though
> These represent the truth values False and True. The two objects representing the values False and True are the only Boolean objects.
 
12:48 PM
@WayneWerner ellipsis is also a singleton
 
True, thanks. Unfortunately those don't do me any good, because I'm trying to show that these kinds of objects are considered truthy. Writing something like "Look, the truth value of True is True! That proves my point!" probably won't be very convincing :D
 
False?
 
...I guess I could list that as an exception, along with None
 
implying...that your point is wrong :P
 
>>> type(...)
<class 'ellipsis'>
>>> ... is ...
True
 
12:50 PM
"Every single on of these handful of python singletons are truthy...except these two" ;)
 
I'm actually looking for builtin objects that don't have an explicitly defined truth value, to show that objects are truthy per default
booleans don't fit that description very well :P
 
hmm, how does bool() work if you don't have __bool__? return True? Is that your exact point?
 
I think there's a bit in the python source that covers this in case that's of interest
 
yeah, this should be easy to prove
 
@AndrasDeak pretty much, yeah
 
jjj
12:53 PM
Maybe I'm not following, but what about empty list? Its falsy if anything
 
aren't containers explicitly falsey if the are empty?
 
Yeah, but lists are sequences and sequences have a well-defined truth value
Andras'd
 
jjj
I see
 
hmm...
>>> bool(object())
True
so python new-style classes will do that ^ anyway
 
That's actually a pretty good example. Maybe I'll add that.
 
at this point you probably have "either you subclass object and it's implicitly truthy, or you override __bool__ in which case you're explicit, or you have a builtin-ish class with a definition in C"
@shuttle87 good find ---v
> By default, an object is considered true unless its class defines either a __bool__() method that returns False or a __len__() method that returns zero, when called with the object.
 
@shuttle87 Thanks, I'm stealing that
 
>>> (0).__bool__
<method-wrapper '__bool__' of int object at 0x55ba9c6dce60>
>>> (None).__bool__
<method-wrapper '__bool__' of NoneType object at 0x55ba9c6b36c0>
>>> (False).__bool__
<method-wrapper '__bool__' of bool object at 0x55ba9c6b27a0>
does anything not have a __bool__? Or are those wrappers just smoke and mirrors?
 
woah, object actually doesn't define a __bool__ method o.o
I assumed those were all inherited from object
 
You may find it also interesting to note that object doesn't define len
 
12:59 PM
hehe, the one exception I didn't check
 
these are fast pathed in the CPython source iirc
 
@shuttle87 I don't find that surprising
neither do any other scalars, right?
 
I believe len and bool are implemented as members in that PyNumberMethods struct like ` inquiry nb_bool;`
 
This is pretty eye-opening. I'm never calling a dundermethod directly again
 
well, you're not supposed to :P
 
1:02 PM
this is quickly turning into one of those cpython source rabbit hole nights where I get no sleep....
 
...wait a second, __dict__ isn't a method. That's pretty much the only dunder-whatever I use directly.
 
dunder non-method
 
There, answer complete and ready to fetch me the remaining 3 upvotes I plan to get today
 
@davidism I'll do it this long weekend.
also \o cbg all
 
@Aran-Fey Why? In most cases what's wrong with using vars ?
 
@JonClements I only learned about vars recently, and I use it in my own code now. But I feel like it's a rather unknown function, so I tend to use __dict__ instead of vars in SO answers.
 
Do you also use __len__ instead of len? :p
 
Luckily for me, len is a very well-known function :P
 
2:00 PM
@user525966 Please read the rules and don't ask questions here that you've also freshly posted to main
 
is this the place for NN questions?
 
2:15 PM
...didn't we decide not to enforce the rules so strictly in the GM?
 
There wasn't even an effort to disclose that they're asking about the same problem in two places in parallel. I already started helping with their question here (half of which was trivial to google), and I wanted to prevent others from doing so.
 
recbg
 
cbg
If there were a reference in the question to the question on main I'd have left it alone
 
fair enough, I suppose, though I don't like it
 
@Aran-Fey I second Andras. Especially no cross-posting.
it is a bad habit ~everywhere
 
2:22 PM
I didn't think it was necessary to mention here, apologies
 
no worries
I suggest that you add the main [python] tag to your question, that will help with visibility. Assuming you're using python with your notebook
 
CABBAGE LAND
 
cbglnd
 
2:38 PM
@idjaw long time
 
I want to write a small Flask example that shows how to use JavaScript to talk to Flask.
A todo app is too boring. What should the app do?
 
@AnttiHaapala
<3 😀 hey
it's been a very busy little while
still is...but trying to keep my presence here too
 
Maybe like a simple game? Hangman or tic tac toe? Just spit balling some ideas
 
@davidism you know the first app that sprang into my mind after your first line??! ... you should write a todo app!
 
2:45 PM
TODO: write a better app
 
haha it's funny how a to do app is always the go to
 
don't do a polling chat :d
 
it's the example I see so many times
 
then idiots will write one
 
Whatever it is, it should include markov chains
 
2:46 PM
write a web scrapper
 
I want fourier transforms
(davidism suddenly regrets asking room 6 for advice)
 
Perhaps a microservice or two
 
each microservice is responsible for the mathematical solutions we are demanding
 
consider including django in the example
 
A microservice todo app on the cloud, on the blockchain
 
2:48 PM
Ok, I went to google and typed "how to write a simple php javascript app that"
 
Legit suggestion: something about grading movies? It's basically a todo app without todos
 
and hit search: The first one: "Chat". The second... "Todo"
 
@AndrasDeak Dress up a todo app with a different name.
 
@davidism hangman
 
yes, so it's no longer a todo app :D Improves UX tenfold
 
2:49 PM
"Make it so", a Star Trek themed todo app
 
How about "dunnitalrdy app"
 
you could also write a dating app and call it TODO
 
the thing with todo apps is that despite all these, the todo apps still suck :D
a time tracker
 
Write a toto app. All it does is play "I bless the rains down in Africa"
8
 
I love you Kevin
 
2:53 PM
morning cabbage
 
Umm... how about making it: "How to write Trello with Flask"?
 
make it a 'stop puppies from stealing my cookies' app
hi pup
 
@idjaw I'm definitely not getting that loving feeling like you seem to be giving Kevin :p
 
I wanted those cookies today
 
cookie logistics app
It's a static page that goes "Has the nuppy eaten my cookies? Yes."
 
2:59 PM
@idjaw wasn't me (for once!)
 
alright pup.... looks around room
 
Hi.. Anyone with some knowledge of cufflinks here? :P
 
they go on shirt arms
 
that ^^^ :)
 
cuffs, even
 
3:05 PM
lol
 
I wonder if the guys in the law.SE chatroom would find a question like this off-topic. "I figured you guys wear fancy shirts a lot" :D
 
Instead of garlic I bet they just yell order in the court.
 
cufflink, here's a word that I've not had any use in Finnish either, and now I learnt its English translation
I do have a pair of cufflinks somewhere, I've never used them though, because I don't have that kind of shirts.
 
Don't hard-boiled noir detectives sometimes refer to handcuffs as cufflinks, in an ironic fashion? I assume lawyers and hard-boiled detectives spend a lot of time together, so they may have picked up on that too
 
3:21 PM
@Antti are the Python logo cufflinks? :p
 
wim
Could RO unstar "the election ends in 30 minutes" it's obsoleted/incorrect now
 
it'll be relevant again in 364 days, just leave it up :p
 
wim
hehe
thanks
 
@Aran-Fey elections aren't yearly
 
oh. Well, it'll be relevant again eventually
 
3:35 PM
hi all
 
@vaultah do you mean mod elections? They aren't annual?
@Droid cabbage
 
i need get all logical operator from dict, can u help me, dict example
 
can someone provide a link to the elections?
@Droid what do you need help with exactly? Provide a code example on a site like pastebin or gist.
 
@Code-Apprentice yes and yes
 
@Code-Apprentice okey
 
3:39 PM
can someone provide a link to the current elections?
or did they close already?
 
@Code-Apprentice They have closed but you can take a look at this. opavote.com/results/5229219307061248
 
I been busy and missed voting ;-(
 
cbg, I have a question regarding the sh module in python
I am trying to do something along the lines of: sh.ls(filepath), and running it from python gives me an error dump of "no such file or directory."
 
I looked at the exact command and ran it on my terminal, and it was able to list out all the files.
 
3:45 PM
@ZackTarr thanks. I saw that link in the starboard but didn't check it out yet.
 
Sam
How would one go about storing sensitive information on a DB but allowing the user to view them raw in the browser? Not talking passwords or personal data here (but still sensitive info)
 
I have no wacky aliasing in my .bashrc, so that's probably not the case.
 
@Sam If it is sensitive enough, you can encrypt the data in the database and then decrypt it to display.
 
Hard to say without knowing your threat model
 
Sam
What will govern the decryption protocol? User providing their password or something?
 
3:47 PM
cabbage
 
please help me, how can i get the result?
 
@Sam Probably yes. I think most the the PHI that I work with in an EMR is actually un encrypted in the database. Im sure there is more security above that but Im not sure what it would be
 
@Droid now you need to show how you expect to call your function. Also describe how the function is supposed to work. How does it transform the input to the output? Then describe what part you are having difficulty with.
 
Sam
I don't think I'd sit easy leaving this stuff un-encrypted
Yeh
@ZackTarr Now I just look nuts :P
 
Sorry re read your first post which stated that. So yeah youll need to have a log in page before that. Then you can use a hash on the passwords and all that jazz.
 
Sam
3:54 PM
OK makes sense. Thanks Zack
 
Not sure if building the log in logic by hand is best or if there is something out there that one of the other regulars knows about.
 
i have problem, how can i do this update nested dict for each result, i have input dict {'AND': [{'OR': [{'AND': ['green', 'blue']}, {'AND': ['brown', 'blue']}, 'blue']}, {'NOT': 'red'}]} and i need the output of such an object paste.fedoraproject.org/paste/aNpwVfzyGLON8hDEYYj91g
 
Sam
i'm using Flasks User module so I can just check against the current user
Return a boolean result from a check password function and then
Bob's ur uncle
 
wim
fun question remove substrings
 
Easy enough then! I still need to learn flask. Waiting on the new tutorial from davidism to start on that task though.
 
Sam
3:56 PM
I have a nice series
Link me to Davidism's?
 
I pinned the new tutorial in the sidebar.
 
hi, can someone help me to visualize program flow, which find data from mongodb server program goes like this
 
Sam
Didn't see that. Thanks @davidism
 
uri = "mongodb://127.0.0.1:27017"

client = pymongo.MongoClient(uri)

Database = client["fullstack"]

collection = Database["posts"]
 
00:00 - 16:0016:00 - 00:00

« first day (2720 days earlier)      last day (2227 days later) »