« first day (3562 days earlier)      last day (1369 days later) » 

3:08 AM
@roganjosh I think what I'm going to go with is testing the individual backend implementations, and then testing the API of my Database object with the various implementations (without worrying about internals). Assuming the tests on the implementations are passing, I should be able to rely on them for what then I guess would be an integration/interoperability level test.
 
 
4 hours later…
7:24 AM
@MattDMo Edited the Q based on the meta answer, I hope it is better now.
 
7:42 AM
(Any suggestions for new improvements, or should I just move it to datascience.stackexchange.com? - I don't really like that option tbh but will ofc if cannot be made fit for SO.)
 
@zabop TBH I don't think you can salvage the question – no fault of yours, the issue is simply out of scope for SO. I'm hoping some of the chat regular's familiar with this kind of data science can help you here, or direct you to a more appropriate SE page.
 
8:02 AM
@MisterMiyagi alright, thanks!
 
8:20 AM
Does someone know if the thread pools from multiprocessing and concurrent.futures start at full thread count or scale up as needed?
 
9:00 AM
a junior dev is using #type: ignore to bypass mypy everywhere
what to do?
 
@RE60K communicate
 
Given my stance on mypy, promote them? :P But on a serious note, isn't this a people-management question? I certainly hope you're not looking for a code solution
 
and they use Any everywhere
 
Ask on workplace.SE or interpersonal skills.SE
 
sure man
 
9:13 AM
Decides to look at main --> question with a screenshot and just "This is my problem. Please solve it as soon as possible." (nothing else) --> retreats
@toonarmycaptain I'm curious whether you still have file-based backends (JSON et al.)?
 
@RE60K Show them an example where they missed an error due to this.
The best argument for mypy is the errors and work it prevents in the long run.
 
9:44 AM
How can I set the name of a Python process? In specific what psutil.Process.name would report about the process. I've tried setproctitle but it does not seem to set the correct value (on MacOS).
 
They all just change *argv, which doesn't fool the program I want to fool. :/
 
linked: stackoverflow.com/questions/2255444/… , uses something Google called procname
But then someone says it didn't work for them and setproctitle did. Clearly you're yet again attempting an impossible task
 
Impossible is my limit.
Sadly. :/
Hm, perhaps doing the major impossible task in a platform-specific manner could turn it into a minor impossible task...
 
10:02 AM
there was a ctypes linux version on my second link...which people say didn't work :D
 
It seems that setproctitle works flawlessly on RHEL7, of course.
@AndrasDeak I'm already 20% less likely to try ctypes answers versus packages. Random Internet People™ questioning its applicability is another -3 to all rolls against willpower.
 
10:20 AM
Another impossible problem solved by answering "what's the best way to check the operating system?". The world is missing at least 10% awesome today.
 
platform.system()?
 
sys.platform?
 
I use that a lot to stop all the automated tasks from running while I'm developing on Windows, since the live version is on Linux. I'm guessing you found another way
mm, I have questions. Foremost being "why am I using platform?"
 
I'm using platform.system() now too. To stop tests from running while I'm developing on MacOS, since the live version is on Linux. ;)
But I'm sure of having used sys.platform and os.name before. AFAIK there are more possibilities, depending on the needed feature set of the OS.
 
All this work just so you don't develop on linux...
 
10:27 AM
@AndrasDeak There's not a snowball-in-hell-chance I'm running the target platform Linux on my machine to begin with.
Might as well use something shiny instead. :D
It's the upcoming push for ARM that I'm sceptical about. The optimistic route leads to a happy future where all code is ultra-cross-compatible. The pessimistic route is what I'm betting my money on.
 
@MisterMiyagi what a beautiful case of convergent evolution :)
Next target: Carcinisation
 
10:48 AM
that'll never work for the blue potato business... 1) it's not made up and 2) it's not even related :p
 
Crabs have no use for potatoes. They need only crab things. I'm not entirely sure what they are, but I don't think potatoes feature on their shopping list
 
admittedly a potato is not something a crab is likely to come across but has anyone tried giving a crab a potato and asking its thoughts hey? :p
 
I know they like bacon
(the hand was to help scale things. I had a competition on who could catch the biggest crab)
 
It was nice of you to feed it a decent last meal before taking it home and putting it in the pan :p
 
Well, no. The sad end to that tale is that a bunch of emos came over and told me how pathetic I was to be crab fishing alone and scared it back into the sea. A proud moment.
But, he did get about 30 mins of bacon-eating action so that's my take-away thought
 
11:29 AM
is it really crab fishing if you're feeding it though... seems more like a humanitarian act... although... the poor thing probably went away and has been tortured by the lack of that delicious bacon ever since... :p
 
This is true. I spent quite a bit of time on the Isle of Wight and there's really not much to do there. I actually worked at a seafood restaurant and I can tell you that that crab isn't edible - so maybe my pastime was really just a banquet for the crabs. I got quite attached to the one in the photo
I mean, you could eat it. I'm just not giving any guarantees about the experience :P
 
11:51 AM
I have a question related to importing.
Is it appropriate to ask here?
I am trying to understand the code here. gitlab.com/ase/ase/-/blob/master/ase/atoms.py
 
It sounds so, as long as you read the room rules first
 
@phenomenon can you clarify what parts in specific you need help with? 2096 lines is a lot of code.
 
In this file, line number 17 imports a module named units.py as follow: "import ase.units as units". In this, why 'ase' is used while importing (while it can be imported as 'import units')? From where the word 'ase' comes here?
 
The name of the package?
I suspect your confusion runs deeper than that, but you're aware that the library is called ase?
 
Yes. It is the name of the package. But how to define it and where to define it?
Link to full package is here.
 
12:01 PM
the folder name defines the package name.
ase/units.py -> ase.units
 
Thank you very much.
 
If you've mainly used Python2, you may be used to implicit relative imports. That is, ase.atoms can do import units to mean import ase.units. This has been removed in Python3 in favour of explicit relative imports, i.e. from . import units.
 
Thanks for clarification.
 
How to do something like this in python?:
format.div("foo")  # returns "<div>foo</div>"
format.div.h1("FooBar") # "<div><h1>FooBar</h1><div>"
 
You're almost certainly looking for CSS
 
12:07 PM
Nope, that's a python programming exercise.
 
I dread to ask, but which?
 
Here's that.
 
nice of 'em to use format as the base name - that's not going to cause issues :)
 
that's a bad practice.
 
Umm ok, so why are we considering this?
 
12:13 PM
"this"?
 
That problem. It's JavaScript, so "that's a python programming exercise" is out the window, and now you're suggesting that the use of Format is bad practice
 
We're not on that same page. :D Here's how:1) The programming language in which you're going to attempt can be changed by clicking on a dropdown(click this You'll be landed on the python version) 2) In python format is being used, and in javascript Format is used.
 
I'm on the Python page
 
and I hope you can see, format instead of Format but that's not the matter of concern.
 
I can. I can also see format.div.p.span("FizBuz")
 
12:21 PM
okay... but you haven't explained what the concern is exactly @iaeliyen ?
 
@roganjosh That's exactly my question(how can I do that?), I've never seen anything like that.
 
@iaeliyen With 99% confidence, my response is "you shouldn't"
This is why I brought up the fact that it's JS
 
hmm, I guess this is quite easy to do in ruby.
 
Why would you need this?
 
it seems that'it is making the wok easier.
 
12:27 PM
... great
woks are great for looking cool. You can flip food right in front of your guests' faces. You'll excuse me for not taking your problem more seriously
 
at least I'm learning what's the traditional way.
 
Tensorflow vs Pytorch anyone
 
Just to note... while you should probably use the xml's ElementTree stuff - one naive (and not recommended) approach using attribute chaining would be something like:
 
Hey Jon how did you become a moderator
 
class Whatever:
    def __init__(self):
        self.tags = []

    def __getattr__(self, tag):
        self.tags.append(tag)
        return self

    def __call__(self, *args):
        return ''.join([
            ''.join(f'<{tag}>' for tag in self.tags),
            ''.join(str(arg) for arg in args),
            ''.join(f'</{tag}>' for tag in reversed(self.tags)),
        ])
then Whatever().h1.p.text.blah('hello', 'there') would give you: <h1><p><text><blah>hellothere</blah></text></p></h1>
@MuhammadBahar I'm curious as to why you ask?
 
12:34 PM
@JonClements Because I was wondering how I can become a moderator
 
@iaeliyen I think it's misguided there. I wouldn't be trying to replicate HTML but maybe that's just me
What I think you're essential asking is how to tag attributes on to a class in some arbitrary manner
 
Actually, there was another problem which was ranked higher than this one, so I thought to attempt the easier one(which I am talking), solving the harder problem was my motivation, and when you asked about the motivation I just stated that it makes the work easier.
 
(won't handle the And finally, we should be able to nest calls. - but that's an exercise for the reader :p)
 
@JonClements Even the hint of __getattr__ would've been enough, I could've dug into docs. All I was asking was for a hint, not for the solution. Thanks.
 
12:41 PM
jane.has(1).head.having(2).eyes.each this is not good python
 
smells like ruby
 
Ha, on that one I was indeed looking at the wrong example <scurries back to hole>
 
@roganjosh did you do that moving sideways while looking for bacon? :p
 
Nah, I went to the Python version and found jane.has(2).arms.each.having(1).hand.having(5).fingers. Much better :P
jane.has(1).head.having(2).eyes.each.being_the.color.blue.having(1).pupil.being_the.color.black this is a joke, right?
 
XD
 
12:47 PM
gotta ask the question - who is Jane? :p
 
jane.is_the.parent_of.joe
 
The person with one head and 2 eyes, duh
 
jane.is_a.person
jane.is_a.woman
jane.is_not_a.man
 
I can only say that I have a super-low view on the coding challenge websites, but this takes the biscuit for me
 
I've always thought it was "Alice" and "Bob"... when did "Jane" start coming into this :p
@roganjosh but yeah... not sure why people are so keen on 'em... always seem to be "hey - you wanna do something that's really never going to be useful in the most complicated way - here it is!"
 
12:56 PM
This is surely beyond bonkers?
 
Knowing you can override __getattr__/other stuff and chain by returning itself is useful to know... but the use cases are fairly rare
 
It's a fluent API, in which all attribute setting methods return self, so that multiple setters can be chained together. In lieu of having an __init__ method with gobs of args. I first saw this code style in the early 90's with Smalltalk. pyparsing uses this style a fair bit too (expr.setName('x').addParseAction(foo).setDebug(). But this jane example is a bit much. Very likely Ruby-influenced. I think jQuery also adopts this form.
 
I imagine that...
... and there we go - the person I was thinking of in this matter has chipped in - hi @PaulMcG :)
 
cbg - I've been inattentive, the day job has heated up lately
 
hopefully that's a good thing?
 
1:02 PM
Yes, it beats the alternative, certainly
My in-memory db littletable also does this dynamic kind of work. To find an element in a littletble.Table (which is a wrapper around a list of objects where object attributes are treated like columns) with a unique index, use the .by method: bondjamesbond = employees.by.empid['007']. by returns an IndexAccessor whose __getattr__ filters on the table of elements by that same attribute.
If empid is a unique index, then this accessor returns a single item. If you used a non-unique index (like .preferred_martini['shaken']) it would return a new Table of all employees who prefer shaken, not stirred.
 
.head.having(2).eyes.each. would be a setter here, not a getter, though?
I've gone through the example code multiple times and I'm not sure I grasp any point that would make sane code
 
1:20 PM
Yes. having(n) probably returns a MultivalueAttrSetter whose __getattr__ method (which is called with the value 2 and receives the arg 'eyes') will turn around and do setattr(obj, 'eyes', [None]*2), where obj is the head object created earlier. Though I don't know how it knows what an eye is supposed to contain.
.each is straight out of Ruby
 
1:31 PM
It may be that these are all just generic SimpleNamespace-type objects, so just bags of attrs.
 
I'd like to believe that the task was designed with such intricacies in mind. My strong suspicion is that it was ill-conceived
 
@roganjosh Yes, just one, lol. I'm part way implementing sqlite. Been trying to figure out an efficient and thorough testing pattern, as I'll be using the same pattern for any others I implement.
 
@toonarmycaptain Oh, I'd been gathering a bag of issues for you :P
 
@roganjosh I want to say "thankyou" but...
 
1:48 PM
<drops one from the bundle> SQLite will only take up to 999 entries for an IN clause, but other dialects don't care. Since you've moved on from JSON, most of my concurrency issues don't apply any more
 
@roganjosh You mean SELECT field IN table WHERE field CONDITION will only search 999 rows?
 
I mean that SELECT * FROM table WHERE something IN some_list will top out at 1000 items. For SQlite.
 
isn't fluent API design pretty common in the data science field? Pandas seems like a prime example.
FWIW, IMO it works quite well for immutable types such as strings.
Not a fan of getters secretly being setters. :/
 
where col_x in ('AAA', 'AAB', ...) can go up to "ALK", but breaks when adding "ALL") (if I did the divmod math right)
 
@MisterMiyagi like it'll only return 1000 items max, or some_list can only be 1000 items? (neither is likely to be an issue in this case, and the only case I can think of where it might would warrant using something a bit beefier than sqlite). Rogan
 
2:02 PM
@toonarmycaptain I wasn't very clear in my response. You can't check for an item being in a collection that contains more than 1000 items
You also pinged the wrong person, but I'm not too fussed by being confused with MisterMiyagi :P
 
@roganjosh Yeah that was weird, and it didn't fix when I tried to edit and correct. You are the db sensei, yes?
 
Sure, I can run with that
 
@roganjosh The feeling is mutual. ;)
BTW knowing that SQlite has some magic internal cap of 1k items is good to know. Please proceed having a meaningful conversation riddled with useful trivia.
 
Best. Day. Ever :D
 
2:19 PM
@roganjosh You've not seen good challenges(TBH they suck but I've no alternatives)
 
@iaeliyen I've seen lots of challenges. Lots of broken systems. There's probably a song for the path I've trodden but I'll need to think about that one. However, I'm pretty sure you can find alternatives in the world around you
 
any examples of alternatives?
 
Meaning a) I don't really put much faith into challenges and b) there's an awful lot of broken stuff about that could be solved
@iaeliyen what are you interested in?
 
1) "faith"? 2) author's mistake.
 
I feel these challenges have some merit if one is willing to say "this feels ugly and I should not do it in real code".
 
2:25 PM
@iaeliyen I'm talking about the world, not author mistakes on the challenges they post
There's a big pot of things to work on
 
@roganjosh a few days ago I was googling "how to get started in software development?" read a lot of blogs, almost all of the blog structures is following: Learn programming -> (gap gap gap gap gap) -> experience of being a software developer. But I know there is a "gap", I am interested in those gaps.
@roganjosh how that's relevant to your "2)"?
 
@iaeliyen Are you really asking me to list broken systems in the world?
 
how the list of broken systems in the world is relevant to your belief that coding challenges are bad?
 
What I intended by that comment was to suggest that there's a mass of real problems that you could "cut your teeth on"
 
yeah, I've felt (bad) that solving the programming challenges is not satisfactorily practical, but I don't know how to get started in solving the real problems. (of course by means of computer programming since there are different genre of problems)
 
2:35 PM
@iaeliyen That gap is usually "trial and error" aka "learning by doing". One cannot build experience by not doing anything realistic.
The real challenge usually to find a suitable thing to do.
Even if it's frowned upon, re-implementing various existing tools is IMO a good way to do something practical and useful.
 
mistermiyagi sounds mystique.
@MisterMiyagi good idea, thanks.
 
There was someone here in chat recently who asked whether building a file browser in flask was a useful public project. Even though there are tons of good file browsers around, I have to wholeheartedly say "yes".
 
^ me :)
 
@MisterMiyagi way to make me feel like a diva. I open the doors and just go "nope" :P
 
@python_learner Hehe, perfect demonstration that your choice was adequate. ;)
@roganjosh Saying "nope" is challenge 3 on the Advanced Road to Enlightenment™.
 
2:43 PM
@MisterMiyagi oh, I thought I could put it at the start of my script or something. print('Seriously?'); continue
 
is the only use of ; in python to "one-liner-ize" code?
 
To my knowledge, yes
I was being silly. I can't think of where else it's valid.
 
I'll use it to drop in a quick import pdb; pdb.set_trace(). I don't even need to engage my brain to type this, it's all muscle memory by now. Looking forward to getting the work environment up to 3.8 so I can change to using breakpoint().
 
The only mention of it in the grammar is simple_stmt: small_stmt (';' small_stmt)* [';'] NEWLINE. That's a fancy way of saying "put many simple statements on one line".
@PaulMcG Uh, is 3.8 realistic for you? I'm still stuck on 3.6 for the foreseeable future.
 
Amazingly our engineering group has leapt from 3.5 straight to 3.8, so I'll soon start upgrading the automated tests as well.
 
2:58 PM
Go for it! Leaving 3.5 behind is worth it.
Programming has taught me a useful lesson: If you want to kill zombies, make sure it's a zombie. Just because it's not running does not make it an acceptable target.
 
3:18 PM
@PaulMcG I read that and think "yay fstrings"
 
3:59 PM
@PaulMcG thanks for pointing that out!
https://docs.python.org/3/library/pdb.html

I wasn't aware of this. I'm also now looking forward to using breakpoint()
 
4:16 PM
def shuffle(self):
        ans = self.nums[:]                # copy list
        for i in range(len(ans)-1, 0, -1):     # start from end
            j = random.randrange(0, i+1)    # generate random index
            ans[i], ans[j] = ans[j], ans[i]    # swap
        return ans
why does this work with self.nums[:] but not self.nums
theres something subtle going on here
 
Do you know what self.nums[:] does?
 
I suspect they both work, but without the [:], then you are probably modifying self.nums when you don't want to?
 
@MisterMiyagi i thought both were the list
(i have googled [:] it said it was the whole list)
 
Always helpful to be a little more explicit when you say something "doesn't work".
 
@MisterMiyagi gets a slice of self.nums, without the upper or lower index bounds, giving an unmodified list, but without the reference back to the original self.nums?
 
4:19 PM
@Permian Then who added the comment # copy list after the line?
 
@MisterMiyagi not my code
im just playing around with it because i saw this nuance
 
Well, what do you think self.nums[:] does considering there is # copy list after it?
 
ans = self.nums
print(id(ans), id(self.nums))
ans = self.nums[:]
print(id(ans), id(self.nums))
 
yes but i thought ans = self.nums is a copy
 
@Permian it isn't
 
4:21 PM
what is it then
?
 
It's an alias.
 
@PaulMcG when i ran this without the self's its actually the same
 
z = [1,2,3]
a = z
print(id(a), id(z))
2078523450688 2078523450688
a = z[:]
print(id(a), id(z))
2078527647296 2078523450688
 
4:23 PM
@Permian do you think that self is superfluous, in that case?
 
It's a variable referencing the same piece of memory as the other variable. Just like when I refer to "the McDonalds on the corner" and "the McDonalds at 123 MyCorner St" -> they're referring to the same location.
 
@roganjosh ah so its like references in c++
 
Please think in "names" vs. "variables". "Variables" conjures up thoughts of memory addresses from other languages.
 
@Permian I'm not qualified to answer that but I'm suspecting "no"
 
no it is because
x = 10
y = x
y is a reference to 10
 
4:26 PM
Similar, with a=z you have two names pointing to the same list. If you do a = z[:], that constructs a new list copied from z, so the names "a" and "z" refer to different lists now.
 
@PaulMcG perfect thanks
that and nedbatchelor link have solved this
 
@Permian See this Q&A for names-explained-with-C-speak.
 
pythons simplicity actually makes it harder than things like c++ at times
 
not understanding how the language works always makes it harder
 
^ Truth
Quick lunch cabbage....where I am eating stuffed cabbage :)
 
4:34 PM
But @Permian's example is misleading. Compare a = z = [1,2,3]; a += [4] and x = y = 10; y += 5. The list example will update both a and z to [1,2,3,4], but the int example will leave x as 10 while y becomes 15. It is understandably confusing.
 
well, discussion of names goes hand in hand with discussion of mutability
 
And implementation-dependent interning always throws a wrench into the thought process.
 
Does it?
 
When people use 'is' to test for integer equality for instance.
 
Yeah, but that's actually an XY problem. If you go from the "x=y implies x is y" angle you never encounter that. Only when you expect that "x=2; y=2 implies x is not y".
 
4:44 PM
@PaulMcG Isn't that a separate problem of using the identity operator to do an equality test?
Mind, not saying people don't do it...
 
It is definitely a separate problem. But thanks to some less-well-informed sources out there (bad tutorials, classmates, older siblings), some beginners think "is" is another way of saying "==". And thanks to interning, sometimes it does work.
 
Some More Enlightened Languages™ actually reject using is on purely value types, for which identity is not meaningful. It's one of those things that I'd like to see in Python as well.
 
I'm betting on python version mismatch.
 
Closed. No need to bet; it got answered
 
comment says all three give them a syntax error, which might mean anything
 
Yeah, but they're only the OP. We can brush that aside
 
5:55 PM
There's a website with a button that lets you toggle your status between "online" and "invisible". When I click this button, firefox's network console picks up no network traffic whatsoever. Should I conclude that the button does nothing, or that it's powered by magic?
 
6:26 PM
Hey all, I've got this quick app that takes a picture from a webcam and then puts it on a Flask web app for display. Is there a way to run this every .1 seconds or so to limit it to 10 FPS and have the web page auto reload? gist.github.com/biggidvs/4a1c78f5f8b999258165311b2bd409ff
 
6:42 PM
@biggi_ flask live video feed are the search terms. gives for example: blog.miguelgrinberg.com/post/video-streaming-with-flask
 
Thanks, I'll take a look. wasn't sure if video stream is what I wanted or if there was a different/better way to do it.
 
 
2 hours later…
user12867493
8:55 PM
Could someone give me a regex to match a here please: a: b(?#c) Thanks
 
user12867493
It will always be followed by a colon
 
regex101.com is a great sandbox for learning and experimenting with regex
 
user12867493
9:11 PM
Why isn't this working?
 
user12867493
>>> string = 'Maktest: Blacklist test6'
>>> import regex
>>> string = regex.match(r".*(?=:)", string)
>>> print(string)
<regex.Match object; span=(0, 7), match='Maktest'>
 
user12867493
Why is it an object?
 
@Daniil seriously, that's very basic regex
please read an excellent tutorial or the docs
and note that the stdlib module is re, not regex, just so you're aware
merci
 
Uh oh, gotta flag all this foreign language communication
 
9:16 PM
KICK US!
 
It's popo central here again. Let me bring some donuts...
 
And bacon, please, thank you
 
donuts and bacon, together ?
 
Just to be clear, you want the bacon wrapped around the donuts or added as a filling?
 
both please
 
9:18 PM
Ugh, no. Separate.
 
So three kinds :'|
 
@Daniil you could open a question about your regex, let's see which question Wiktor will choose to close it as duplicate.
 
Good point, save some donuts for Wiktor
 
user12867493
@Jean-FrançoisFabre No, I don't want to get downvoted and barked upon in the comments
 
I should note at this point for the pythoniously challenged among us that python has excellent official documentation and an okay tutorial. Don't know if and how the re module is included in the tutorial.
 
user12867493
9:21 PM
I want regex not re
 
@Daniil why is it an object? because it's way more convenient like this. If you want the text just do string.group(0) or something
 
"Why isn't this regex working?" questions aren't really a good fit for SO. There are great interactive regex testers/viewers that will tell you exactly why, and help you to fix it.
 
@Daniil how do you know that?
 
re module also returns a match object.
 
user12867493
@AndrasDeak Because it's what Charcoal uses
 
user12867493
9:22 PM
@Jean-FrançoisFabre Thanks, the group helped
 
YW
I'm a moderator but I also have a heart
 
Where do you keep it?
 
The APIs are very similar, if not identical. What do the docs tell you that regex.match or re.match returns?
 
And whose is it?
 
Hey, that's not fair! I had to turn mine in before I got the diamond.
 
9:25 PM
The rules have changed. Now you get to keep it
 
Is anyone else having trouble connecting to a lot of sites?
 
Discord is down for me, but I haven't noticed any other issues.
My work email is, unfortunately, still up :-(
 
Seems like it might have something to do with Cloudflare.
 
there are other sites?
 
Ah yeah, imgur seems to be down, too.
 
9:28 PM
Lot's of stuff down here too
 
I'm getting a lot of DNS timeouts on Cloudflare nameservers.
 
imgur loads fine from Europe
 
as long as I can link to youtube to rickroll people I'm all right
 
print("Hello People!")
 
user12867493
SO autorefresh is down as always
 
9:36 PM
Looks like Cloudflare's back.
 
10:32 PM
A few days ago SO was down due to maintenance and it felt so surreal. Sometimes we take things for granted too much. I even felt a little, how dare they go down :D
 

« first day (3562 days earlier)      last day (1369 days later) »