« first day (2840 days earlier)      last day (2094 days later) » 

user8729657
12:56 AM
Hello!
 
user8729657
So, I was thinking about something I read about python. I wanted to know what the difference between web scrapping and API's are?
 
1:08 AM
Website's APIs are officially published by the website itself so the users could get data from websites without web scraping (without putting loads of unnecessary traffic on the website)
Also if a website does have an API chances are that that website's policies make it illegal to scrap the website
Using a public API is perfectly legal, web scraping is often not
When you're web scraping a website you're putting unnecessary load on it, which damages the website's network, using a public API though, you're not damaging the website's network and you are using the recommended way of getting data from a website. Private APIs are obviously not available to the public and are often used by developers to connect front end of the website with the back end
 
user8729657
Wow, that's very interesting thanks!
 
4:21 AM
Cabbage
 
4:56 AM
Cabbage
 
5:49 AM
@roganjosh I agree that it does seem like there's been a recent increase in obvious dupes getting answers from people who ought to know better. My theory is that it's more welcoming to post an answer than to dupe-close. ;)
@AndrasDeak Hopefully, the next generation of IoT devices will have better security, and be hardened to variations in environmental factors such as temperature, humidity, dust, etc. Then we'll have the Secure Hardened Internet of Things.
 
Heh
 
6:14 AM
@PM2Ring The implied acronym was a nice touch :D
Thursday cabbage!
@ZackTarr I switched to Atom Editor from Sublime Text and haven't looked back since. Fair warning though, it's not an IDE, but it has various plugins that help make it so.
 
6:38 AM
@AndrasDeak Hammered, although that target is a little old, so it doesn't mention f-strings. And neither it nor the answers on the new question mention using sep='', so I added a comment.
 
FWIW stackoverflow.com/a/51406767/5067311 but admittedly I just wanted it closed as something reasonable
 
@AndrasDeak Ah right. I missed that one. :) But I did notice there was an answer from Amber, who I know from xkcd, and who I learned about Stack Overflow from. But for some reason I didn't register on SO until a couple of years later. If I'd joined up when Amber was all enthusiastic about SO I might have as many points as she does. :) I haven't seen her post on SO much lately, I guess she's too busy doing stuff at Google.
 
6:59 AM
morning
 
7:15 AM
The blind leading the blind stackoverflow.com/questions/51532012/…
 
I am having problems with JSON reordering of the dict when saving to a variable....I have tried OrderedDict but it does not seem to work.....any pointers?
 
@PM2Ring yeah, I've only seen her in old posts
 
@lordlabakdas JSON itself doesn't support ordered dicts. So no matter what you do on the Python side, when you convert it to JSON, you can forget about any order being preserved.
 
What is then the best option to preserve order? I am trying to convert the JSON to a list with the same JSON order
@PM
@PM2Ring tagging you
 
You can edit/delete messages for 2 minutes after posting. And no need to ping him, he's right here
 
7:19 AM
@AndrasDeak oops sorry
 
@lordlabakdas If you need order to be preserved in a JSON object, then you can't use a dict. It's as simple as that. One way around that is to use a list of single item dicts, eg, {"stuff": [{"first_name": "Bob"}, {"surname": "Smith"}]},but that's gross, IMHO. And generally not necessary.
 
Isn't json inherently unordered?
 
@AndrasDeak A Python dict becomes an object in JSON / JavaScript, and a Python list becomes an array. A JSON array preserves order, a JSON object doesn't.
 
I see
 
Morning cbg
 
7:33 AM
When saving Python data to JSON you can tell json.dump to sort the keys, but that will crash (in Python 3) if you have a mixture of string and integer keys. And of course that only gives you lexicographic order, it can't preserve insertion order, or any other kind of order. And whatever reads that JSON is under no obligation to preserve the order of items in objects.
@lordlabakdas So tell us a little bit about your data, and explain why you believe you need to preserve order.
In the mean time... I was messing around with PIL this morning, experimenting with its palette-mapped mode, and its ImageDraw module. Here's some code that draws nice coloured grids. I condensed it a little so it wouldn't take up too much space here...
from PIL import Image, ImageDraw
pal = [255,0,0, 255,180,0, 255,255,0, 0,255,0, 0,0,255]
ncolors = len(pal) // 3
w, h, size = 8, 5, 30
width, height = w * size, h * size
mx, my = width - 1, height - 1
data = bytes(u % ncolors for u in range(w * h))
img = Image.frombytes('P', (w, h), data)
img.putpalette(pal)
img = img.resize((width, height)).convert("RGB")
dark, light = (64, 64, 64, 160), (255, 255, 255, 160)
draw = ImageDraw.Draw(img, mode="RGBA")
for x in range(0, width, size): draw.line((x, 0, x, my), fill=light)
 
@PM2Ring I meant "json object" when I said "json" :)
 
@AndrasDeak Yep. I assumed you did, but I just wanted to make it perfectly clear for lordlabakdas.
 
and for me; I'm quite oblivious to json
 
7:57 AM
I've answered quite a few JSON questions, but mostly to 1 rep newbies, so I need a few more points before I get a bronze tag badge. :)
 
8:15 AM
cbg
@PM2Ring you'd hate ndjson then I guess :)
 
I have data such as {"a":1, "b":2, "c":3} which needs to be converted in the order [1,2,3]...the order is hardcoded in another place (which might change in the future)
 
It's not really clear to me what that means
 
8:31 AM
@lordlabakdas I think what PM is suggesting is that you transform your dictionary into a list of pairs, since lists will keep their order. and on read transform it back into a proper dictionary.
Do you know how to do that?
 
In other words, {"keys": ['a', 'b', 'c'], "values": [1, 2, 3]}
 
ah
now I get it
 
No more python for me for a week :'( back to the copy/paste fest of this ridiculous custom language designed by a sociopath
 
8:57 AM
Hey guys! I have a question please :)

In Tkinter, I'm trying to create an UI which expands when a checkbox is checked. (it adds few additional labels and textboxes. I bound an int variable to the checkbox and tried using the following piece of code to make the UI change on demand:

if self.checkvalue.get():
self.frame4=Tkinter.Frame(self)
self.frame4.grid(column=0,row=9,columnspan=7,rowspan=5, sticky="w",padx=2,pady=2)
self.label2=Tkinter.Label(self.frame4, text="Robot")
self.label2.grid(column=0,row=0)
 
Are you sure the body of the if statement is executed? Can we have a Minimal, Complete, and Verifiable Example?
 
Second please.
Yes. I just verified it by making another button already in use print the value of the variable used with the checkbox. It indeed does change, so the if statement should be running (and it does if I reverse the expression with not). Is there a way to force initialize again or does it run every time with mainloop anyway?
I will post the examples in a minute
The part regarding the checkbox and its value:
`self.checkvalue=Tkinter.IntVar()
self.check1=Tkinter.Checkbutton(self,text="Varijable zglobova",variable=self.checkvalue)
self.check1.grid(column=0,row=8,sticky="w")

if self.checkvalue.get():
self.frame4=Tkinter.Frame(self)
self.frame4.grid(column=0,row=9,columnspan=7,rowspan=5, sticky="w",padx=2,pady=2)
self.label2=Tkinter.Label(self.frame4, text="Robot")
self.label2.grid(column=0,row=0)`
Gah sorry, tried formatting it as code..
 
My SO participation is now limited to "write the author's question on google, click the first SO link, find the answer, link dupe."
10
 
Thanks
 
9:06 AM
At least when the question is a valid SO question.
 
The code you posted looks like the if statement is executed before the user ever has a chance to toggle the button.
 
And by the time that's done, somebody answered with the same answer as the dupe.
 
Okay, I'll try look into it, thanks.
 
If you check the value of a IntVar right after you create it, it'll always be set to 0. You have to rerun that if statement every time the button is toggled
 
I will try that. Thanks :)
Added an additional method and copied the if statement inside. Added it as a command to the checkbox and it works now. Thanks a lot :)
 
9:22 AM
@roganjosh No, I don't hate it. However, it is annoying when an OP wants to process some line-delimited JSON records, but in the question they just say that it's JSON, and they don't show you a data sample.
 
@Aran-Fey sorry to be bothering again, but now I have a different kind of a problem. When I click the mentioned checkbox, as the interface expands with new elements, a label on the topside gets cut out like this:
Before: http://prntscr.com/kb7q0c
After: http://prntscr.com/kb7q64

(notice how the label on the top side disappears). Resize is set to false for both x and y, but enabling it didn't really help. (brb in 5 minutes, I won't be able to answer right away)
 
@Meaty Not sure why that would happen. It doesn't look like you've accidentally placed another widget on top of the label, so the only explanation would be that you destroyed/removed it somehow. Can't help you figure that one out without a MCVE.
 
@Aran-Fey I forgot to add, upon allowing resizing and expanding the window a little, the label appears, so it really is cut off and not destroyed.
I can post the code to pastebin if you'd like. It's around 300 lines.
 
That's a bit long, but alright
 
Mmm, working in the Engineering office is interesting. The head electrician running out of the office on the phone shouting "No, then we'll have to replace the explosion panels" doesn't exactly fill me with confidence
 
9:32 AM
I will try highlight the interesting part and leave the rest just in case you need any of the code to see what happens.
pastebin.com/5DmVVc4R. Line 71 and 329 are the ones I mentioned. Sorry if it's not fully readable.
 
Lots of copy/paste programming going on in there... You seriously need to get rid of your 40 56 textbox variables and stuff them into a list instead
 
Ok
I didn't really copy from others, I didn't have another idea how to make a table so I just added a textbox next to each other and pasted them until I got the table lol. Thanks though
 
9:48 AM
Hmmm... Somehow you've prevented the window from resizing itself when new widgets are added...
 
Yes indeed. When commenting out the center method the problem is fixed, but then it doesn't center the window on the screen. It seems if you set the window size up front it doesn't auto resize anymore.
 
Oh, it's because you set a fixed window size in your center method. Don't do that I guess. I'm late, I guess.
 
Ok. Is there any other way to adjust the window to the center of the screen? It's a little annoying that it appears on top left side. I guess I can live with it if I can't though. Thanks a lot. :)
I will try to find the solution, you've already helped anyway and i believe the rest can be googled. Thanks :)
 
It seems to work if you don't set the size in the geometry string: toplevel.geometry("+%d+%d" % (x, y))
Time to downvote all the answers here...
 
Haha great. Thanks :)
 
10:04 AM
58k view
 
 
1 hour later…
11:06 AM
@Aran-Fey @Meaty "If you check the value of a IntVar right after you create it, it'll always be set to 0. You have to rerun that if statement every time the button is toggled" True. However, the Tkinter IntVar, StringVar etc can be given a trace callback function. See the docs for some info and a small example. There are further examples on the main site.
 
 
1 hour later…
12:19 PM
cbg
 
cbg
 
1:08 PM
Good day :)
 
1:23 PM
\o half cbg
got a summer event from the company so I will only give a half cbg D:
 
Interesting that you can determine the type of a raw json value just by examining its first character. Objects, arrays, strings, true, false, and null correspond to {["tfn. The only remotely nontrivial one is numbers, which can start with a digit or a hyphen.
I wonder if that's an intentional aspect of the design? Makes it comparatively easy to write a recursive descent parser
 
Are you familiar with this issue @Kevin? Widgets inside a canvas block the canvas from receiving events. I guess that makes sense, but it's annoying when you want to be able to scroll the canvas with the mousewheel. stackoverflow.com/questions/51538818/… It sounds vaguely familiar to me, but I don't remember having a problem with it in my code, since I rarely put widgets into my scrollable canvases.
 
I think I've heard that problem a couple times before, but I don't know what the solution is. I don't put widgets in my canvases either.
 
1:40 PM
No worries. Maybe Bryan has a magic solution. :)
 
If w3schools.com/python/python_arrays.asp is responsible for every Python newbie calling lists "arrays", I am going to dismantle w3school's physical headquarters with my bare hands
I have a feeling that they've already gotten complaints about that page, so they added the little "Note: Python does not have built-in support for Arrays, but Python Lists can be used instead." disclaimer at the end (which is itself wrong, because array is a built-in module)
"Here are ten paragraphs of information: [...] (note: information is incorrect)". Job's done
 
1:55 PM
Well, when I started python I called this array too. Was assimilating it to C I learned before
 
@Kevin I'd heard that w3schools is better than what it used to be, but I guess not much has changed. meta.stackoverflow.com/questions/280478/why-not-w3schools-com I must admit that in my early days of learning JavaScript I used to check w3schools, until I was told that was a bad idea. And then I had a look at the JavaScript they used to run their own site. Oh boy! What a revelation! A dead gerbil could write better code than that. :)
 
But they are probably not helping
 
FWIW, years ago the W3C requested that w3schools change their name because it was too close to W3C, and they didn't want people thinking that w3schools is somehow affiliated with or endorsed by the W3C. You may note that the w3schools site even looks similar to the W3C...
 
Coming from another language that has native arrays, and assuming that Python also has native arrays, is perfectly understandable. Willfully spreading misinformation to impressionable readers is a crime against humanity.
I submitted an error report, but I'm not optimistic
 
Yeah, don't hold your breath. :)
 
2:04 PM
Now that my temper has lowered to below "incandescent", in hindsight I probably should not have sent my real email address to the most mustache-twirling website I interact with
 
@PM2Ring ...
Thanks a lot.
Oh Yam I've been stupid.
 
It's hard for me to become even more upset with w3schools than I already am. I consider them to be a major cause of so much of the terrible JavaScript in the world. There are worse sites, but they tend to be obviously bad, littered with typos & misinformation that even a newbie can spot. OTOH, w3schools looks ok on the surface to the uninitiated, but it's full of misinformation, obsolete techniques, or just plain dumb ways of doing stuff.
 
If you're saying "I feel dumb that I assumed W3Schools was affiliated with W3C", you shouldn't. W3C wouldn't have complained in the first place if they didn't think there was a real chance of perfectly intelligent people being misled.
 
I got that W3C vs w3schools info from my xkcd buddy Tab Atkins, who is on the W3C CSS Working Group (as well as being a developer at Google). W3C didn't just ask once, they've asked repeatedly, to no avail, and they don't want to waste money taking it to court. I guess they also don't want the possibility of not winning the case.
 
Yep, that is what I was saying Kevin
 
2:14 PM
There was (is?) some kind of crusade against w3schools links in answers / comments. Sadly those comments tend to be deleted, since it might not be so's role to not propagate less than optimal information.
also cbg
 
@FĂ©lixGagnon-Grenier Yep. I linked to a Meta SO question about that a little while ago.
 
Ah yes, I see it now
the image of the dead gerbil writing javascript is both incredibly glorious and very unsettling.
 
Yep, until now I was in the W3Schools was affiliated with W3C camp.
 
Time to start a grassroots lawsuit. See you all at the hearing
 
Even if W3Schools did provide good info I'd still be offended by their sliminess of passing themselves off as being affiliated with W3C.
 
2:28 PM
Unrelated topic. The open source project I'm contributing to doesn't seem to be fond of my philosophy of "in case of error, crash in the most obvious possible way". Apparently end users don't like seeing stack traces???
 
You should be happy to see a stack trace, because that means your bug report will be responded to one thousand times faster than "sometimes I try X, but it does Y instead, but not always"
 
A friendly message like "hey that screwed up, click here to send this long stack trace you do not want to see to our army of monkeys" might make it?
 
Where would be the fun if you know how to patch? As it is not stated in the PEP 20, complicated is better funnier than simple.
 
The project doesn't have "click here to send us a bug report (with stack trace magically included in a way that you, the user, don't ever actually have to look at it)", but it does have "something went wrong, please copy the incomprehensible contents of this box and paste it into our bug tracker at [url]"
 
2:34 PM
@Kevin They're mad. Code that is wrong is supposed to crash as noisily as possible. Would they prefer if it just silently corrupts data, or reformats hard drives?
 
Rbrb all.
 
See ya, @T.Nel
 
Devil's advocate:
1) it's a video game, so nobody's going to die from a suppressed exception unless we really really messed up.
2) the code in question is responsible for displaying spline data in Spline Detail Window B, so if we do `try: ... except: log("oops, couldn't display spline data")`, then in the worst case, the user now has to find that info in Spline Detail Window A.
Maybe they're more accepting of noisy errors when it comes to modules that actually have a remote possibility of reformatting the hard drive
 
I guess that's a reasonable argument. Especially when the devs know there's a bug, but just haven't figured out exactly how to fix it.
 
Wow. I expected this question to blow up, but not that much. 100 upvotes for a useless triviality...
 
2:49 PM
Guys, I am running an iteration where if the condition matches I don't want it to print on my csv file and basically sort of skip that particular iteration if it matches the condition. I am trying to do
if: (condition)
pass
But this is not working. It is still printing that iteration.
Only nearest solution I could think of was to do:
if(condition)
a = None
So this would just mark it on my csv file so later I'll go back and delete it.
please suggest
 
@Aran-Fey damn. I wish I knew how to question trivial stuff
 
@KaranM I think you're looking for the continue keyword
 
@Aran-Fey I guess those guys don't do much code golfing.
 
@Aran-Fey So instead of pass, I should type continue, and that will basically skip that iteration?
 
@KaranM Yes.
 
2:52 PM
@KaranM You should try it in a small example program. Eg:
for i in range(5):
    print(i)
    if i == 3:
        continue
    print(10*i)
 
@Aran-Fey Oh yes! that worked.. I know this was silly but I have just started learning Python. I only thought of 'try' and 'except' or 'pass' and couldn't think beyond that
@PM2Ring Thanks! I only took 2 iterations in my program and ran the script to check it :D
 
pass doesn't do anything by itself. Consider the functions at pastebin.com/YFpMSGmA. I'm guessing the code you had to begin with is similar to f1. f2 is basically what Aran-Fey is recommending. You can keep using pass if you really want, by using it the way f3 is. But ultimately, you might be able to avoid both pass and continue, if you can structure your code like f4.
 
@Kevin Ah! I am not able to go on this website. My office firewall is blocking it. I will check this on my personal laptop :')
 
pass only skips the pass statement itself. You mostly use it while developing. Eg,
if condition:
    #Do something here
    pass
else:
    print('condition failed')
Without the pass, you'd get IndentationError: expected an indented block
 
I can't think of many use-cases for pass in production-quality code. Abstract base classes, maybe? But even then I'd prefer to raise a NotImplementedError or something.
Are Nonabstract base classes a thing?
 
3:11 PM
You mean like object?
 
I mean, sure, people write classes all the time which are intended to be directly instantiated, and which also have inheriting classes.
I'm imagining... A class that has a function which is totally useless, and subclasses are expected to override it.
 
But the class can be instantiated, and it works?
 
class PetRock:
    def feed(self):
        #pet rocks are immortal. Therefore, do nothing.
        pass

class ChiaPet(PetRock):
    def feed(self):
        watering_can.apply_to(self)
 
PetRock() <3
 
I'm sure a few of those exist, but I don't think we need to categorize base classes based on the uselessness of their methods :p
 
3:22 PM
The pet rock does not accept your love. But it doesn't reject it either.
 
>>> rocky = PetRock()
>>> rocky.feed()
>>> rocky.feed()
>>> rocky <3
<3 <3
True
>>>
 
You can override __lt__ and make thing <3 evaluate to whatever you want. But thing <3 <3 <3 can't ever be True. Is... Is this a metaphor?
"There's such a thing as too much love", claims dev team
 
xD
def __lt__(self, other):
    if other == 3:
        print('<3 <3')
        return True
    return False
^ did that btw.
 
recbg
 
Now let's argue about whether it's a violation of the Liskov Substitution Principle that PetRocks live forever and ChiaPets don't
 
3:37 PM
It's not a violation of LSP for PetRocks to not have a lifespan attribute or an is_alive method and for ChiaPets to add those attributes.
 
cabbage!
 
I think Wikipedia is skipping some important points about LSP because I have never understood how it's possible to write a subclass at all while still respecting it. for example, "you get an attributeError when you try to do o.imag" is a property provable about object instances. And yet int inherits from object, and that property does not apply to int instances. So doesn't that violate LSP?
I suspect "property provable" is meant to be considerably more strict here than their plain English meanings, but the article doesn't offer up another interpretation
 
A child is allowed to have attributes / methods that its parents don't have, but it must have all attributes / methods that its parents have. So if you pass a child to any method that works correctly on the parent type(s) the method will behave correctly on the child.
 
DSM
Halfway-through-daylong-meetings cabbage.
 
I expect "correctly" is defined on a case-by-case basis
 
3:50 PM
But I agree that the Wikipedia article on LSP is a bit confusing. Computer science types are worse than lawyers when it comes to using too many words to explain stuff. :) I realize that they're aiming for precision without getting bogged down in implementation details, but they don't make it easy for us mere mortals. :)
@Kevin The child can internally respond how it likes when its attributes are accessed and its methods called. As long as it quacks like a duck when expected to do so, everything's fine, as far as Auntie Barbara is concerned.
 
@PM2Ring Wait...You don't consider yourself a "computer science type"?
 
So "this object has this attribute" is a provable property, but "when method X is called with arguments (Y, Z), then it returns Q and has side effects R" is going too far
If not, then int is a naughty subclass for not returning object when you call type(int())
 
@Kevin If "accessing the imag attribute raises an AttributeError" is part of the class's public interface, then you're not allowed to change that in a subclass. If nobody has bothered defining what should happen when imag is accessed, you're free to do whatever you want with it.
 
@Code-Apprentice I'm only a humble amateur. :) Sure, I occasionally attempt to read CS papers, but it's not easy, and I often find myself wanting to see a nice clean pseudocode example in some kind of notation that doesn't involve multiple levels of subscripts & superscripts.
 
@Aran-Fey What's interesting to me is that it sounds like you can change whether a class follows LSP without actually touching it. If you add "all instances of object(), including instances of subclasses of object(), should raise an AttributeError when you try to access their .imag attribute" to the documentation, then suddenly int goes from obeying LSP to disobeying it. Even though you didn't change a single byte of code.
By this interpretation, LSP is shockingly "soft" in relation to other OO design principles
 
4:02 PM
enervated recbg
 
throws Andras a beer
 
I appreciate it (but I don't drink beer ;)
 
@FélixGagnon-Grenier Some of us Andreases are a bit strange. Not all though, so you can throw it to me instead :D
 
quickly redirects to Antti
 
@Kevin Agreed. I've always thought of LSP as an obvious and pointless "don't do something stupid" kind of principle (:
 
4:07 PM
Well. "don't change the meaning of your types through reckless inheritance" is slightly better than "don't do something stupid" ;)
altough, don't ever inherit, always implement interfaces (when language allows) is my preferred way of seeing it
 
– How did you end up with this huge technical debt?
– I inherited it.
4
 
4:29 PM
Hello dudes, if some one knows scpray and have a little time to help, check here pls, tks
https://stackoverflow.com/questions/51543561/understandin-how-rename-images-scrapy-works
I need rename downloaded images see all question, but im new in python and want learn how that works, my code works except rename...
 
@MagicHat there's a room rule that usually advises against posting new questions in here until they are eligible for a bounty
 
@user3483203 Hum, sry first welcome tips.. i try remove, no more time lol
@user3483203 i can ask with the code insteed question post?
 
If you're saying "instead of linking to the question, can I just paste the contents of the question in this room?", we'd prefer if you didn't
 
@Kevin No, i try sayng, find someone to speak about code like a python lover! Of course with that come the real code...
 
If you're saying "what if I just start an interesting conversation, which just happens to eventually segue into the same problem I posted about?", that's not unprecedented, but in practice it's pretty hard to actually start an interesting conversation
 
4:38 PM
Just from looking at your question, it seems a bit unclear. If I am reading it correctly, you have working code that you want to work in a different way. But it's unclear how it's currently working, and how you want that behavior to change. You'll probably get better answers if you clarify both of those things.
 
@Kevin fo me comunication happens with requests and responses, intesting is about personal parameter, my intenton is not be boring, but speak with masters is awesome...
 
Don't clarify here, clarify your question
 
@AndrasDeak i just copy...:)
 
I'm pretty sure I asked you not to do that
 
@Kevin What a problem with that? Just for understand, and can to pont rule for this room, i think start with wrong foot...
 
@user3483203 @Kevin
"Don't ask for answers to your recent Stack Overflow questions. Those who can answer are already watching the queue on the main site."

Well im not trying get direct answer for my question, for real, try start a interting conversation(fo me) about scrapy tool to rename img, and use my problem lile scope... I like(love) solve my own problems and pass days before come here, but love too speak with know real understand the tool... if I was made to understand wrong, im just human try be better...
 
I won't stop anyone from having a conversation about scrapy, but it doesn't seem like anyone's particularly interested.
 
@Kevin why scrapy is not intersting tool? Or im figure like a boring people?
 
The same could be said about any library. Interesting conversations usually happen organically from someone making an interesting point to start it off with a defined point. I'm pretty sure I'd find door handles interesting if someone told me they could reverse ageing
 
5:05 PM
On an unrelated note, has anyone heard that door handles can reverse ageing?
 
Omg, and my phone is about to die! Can they charge phones too so I can hear more?
 
Simply accelerate the door handle beyond the speed of light, and ride it into the past where you're younger
 
Maybe i have that key to open a door to imortality, who knows, and start with the python problem to arrive that goal... lol
But with low reputaion who run risk to thutst me
 
Wouldn't the site you're scraping technically have the key?
 
Its only a fish, to "scrapy" Pitagorean followers...
Rules about img, for fun?
 
5:45 PM
@MagicHat I believe you overestimate the real impact of reputation, and underestimate the efficiency of concise, acceptably well-written and eloquent arguments.
 
@FĂ©lixGagnon-Grenier Believe is the beginning of everything, if you believe I respect your truth
But for this case, its not help
Think about, like a friend... en.wikipedia.org/wiki/Socratic_method
 
5:59 PM
I was not really trying to help, as you do not seem in need of help, but simply pointing out a relatively common mistake. That is, if people do not follow your advice, pointing it on low reputation is... probably misguided.
 
Beaver cabbage
 
6:16 PM
ANyone in here use Ubuntu/linux? I'm dual-booting it now as a bit of an experiment. I want to install Python 3.7 to develop with, but don't want to disturb the system python that a lot of things apparently rely on. Is there a best practice way to do this without using a 3rd party compiled version?
 
It is bad when a general dialogue becomes personal, but I understand, not always I am correct in my words. "Perfection lies in imperfection"
Even imperfect I try to be better, understood, the interpretation is not only based on the eloquent of the speaker, but in the parameters of understanding of the listener.
Even though it is not helping, every iteration produces positive effects for the seeker.
Im search for help, and ever i find...
Finaly here stil SO...
 
I'm pretty sure you can install Python on Linux without hurting the preinstalled version
 
I've never had very good experiences running multiple versions of python without something like anaconda/pyenv
 
@toonarmycaptain the only downfall I've experienced (I have about the same setup) is when I tried to symlink the /usr/bin/python towards python3, whereas it was python 2 before. Stuff started to act weirdly on all fronts, but multiple versions is not a problem
eg if the system expects the global version to be 2, leave it there
 
Dang, I could swear I've seen the "RESTART:" message from Perplexing issue with Python IDLE Shell before, but I can't find it in any idle questions that I've answered. Maybe the guy self-deleted, or it got closed as a typo, or something...
 
6:26 PM
@FĂ©lixGagnon-Grenier very much so. Don't touch python and python3. If you want python use a virtualenv
@toonarmycaptain I'm not sure how non-default py3 packages behave but you can always build your own and altinstall instead of install
 
@AndrasDeak It comes with 3.6.5 at present
So sudo apt-get install python3.7 -venv is the way to go?
 
cbg
thanks for all the help the other day with my plot
 
I thought pythonistas installed all versions in existence, then create new venv for each project with the needed python version
 
I did that long before I could possibly consider myself a pythonista and built an interesting jenga tower
 
6:45 PM
@toonarmycaptain apt vs -venv?
And that's completely not what I suggested
 
Umm... just seen stackoverflow.com/questions/51521158/… - interesting :)
@toonarmycaptain Or download the source, compile it, and make altinstall it ?
 
in the back grumbles something about folks bashing php when such a fantastic side effect garners hundreds of upvotes
 
@JonClements what I said ;)
 
@AndrasDeak grrr... sorry... didn't see that... tired eyes and all that...
 
It's OK, toonarmy missed it too probably :D
 
wim
6:56 PM
+1 for make altinstall
@FĂ©lixGagnon-Grenier yeah, uhh, don't do that.
 
heh ;)
yeah, I er... noticed at some point :)
I was full of "what could possibly go wrong". a thoroughly enjoyable moment.
 
wim
@JonClements hammered ... LOL
how it got to +129
 
Syntax puzzles get a lot of votes if they're fun
Unsurprising that lots of users don't care about "community standards" of what's upvoteworthy
 
wim
and nobody downvoted accepted answer ... amazing
"Python seems to interpret..." seems to? no reference?
 
Answers get a lot of votes if they look correct
 
wim
7:09 PM
But there are perfectly good answers that have the whitespace docs reference and the tokenizer and the parser
how the top answer is the guy that said "well I guess python might be doing this..."
 
maybe people can associate themselves to the person who's just "well it kinda sorta looks like foo bars the baz"
 
Well, he did post a link to the reference in a comment
 
wim
7:21 PM
Ah, true. This should be in the answer directly, first and foremost.
ironically, the best answer (tokenizer) is last, dis and even the ast have already missed the boat
 
er... I'm not sure how to understand "package" as mentioned in this answer about a . in imports. I think "module" generally refers to a single file, the package would be an ensemble of modules/files. So, the dot refers to the file's containing folder?
.. nvm the comments are there to the rescue
 
wim
a package can also just be a single file
"package" is a really badly overloaded word in the python world
 
when i try to change an attirbute of a django model object and save it
what ends up happenign is that it just creates another empty object with that attribute and leaves the first
 
wim
in packaging you package your package into a package distribution
 
7:28 PM
does anyone know why this happens?
 
oh, package as in discoverable by pip (? or like, the general way through which we can install plugins / stuff like numpy or pandas)
... but then, shouldn't the answer mention "current file's working directory" (if it effectively is what happens) as opposed to package?
 
wim
yep
these things are packages distributions
 
wim
@FĂ©lixGagnon-Grenier no
because packages don't have to keep all their modules in the same directory
it's complicated ...
 
so, could the dot refer to any of these different directories, if somehow the package would also define a few places in which to look when importing stuff?
 
wim
7:35 PM
yep
It should say from where the importing package is. It basically means the current namespace or package directory. — Keith Dec 5 '15 at 19:05
namespace is the key word there. a package declares a namespace. you can scatter the actual modules all over the filesystem if you want to.
"package directory" is a simplification that will cover most typical use-cases though
as a first-order approximation you can think of a package as "a directory with an __init__.py file in it" and a relative import, found in a file foo.py, written like from .bar import baz would refer to "the bar in the same namespace as the package foo is within", which most of the time means "a bar.py file contained in the same subdirectory as the foo.py file"
however, it's good to be aware that thats a gross simplification. a module doesn't even have to be a .py file on disk at all.
 
well, that is a very dot-connecting (no pun intended) "gross simplification" to my current understanding :) thanks.
 
wim
from ..bar import baz would usually be a bar.py in the parent directory. however, you can't step "outside" the top level of the package structure.
thinking of a nested dict (where the keys are strings, and the values are either dicts or modules) is probably a better analogy than thinking of directories on a filesystem.
 
7:51 PM
... though that usually also does not equate to always.
 
wim
8:06 PM
>>> class A:
...     def __init__(self, var):
...         self.var = var
...     def __getattribute__(self, attr):
...         return 'nah...'
...
>>> a = A('hidden val')
>>> a.var
'nah...'
>>> a.__dict__
'nah...'
>>> dir(a)
[]
got a fun puzzle for you guys
how to access the hidden state?
I know one easy way, and one bat s**t crazy way ..
 
Instantiating that class breaks using locals() in a REPL
 
lol, Pycharm is unimpressed with __getarttribute
"old-style class contains __getattribute__definition"
 
object.__getattribute__(a, 'var')
 
@FĂ©lixGagnon-Grenier booo python 2!
stop that right now :P
 
... not my faul, it's the project that's like that!!!
 
8:11 PM
@wim del A.__getattribute__ :P
 
wim
too late to edit it now but you can put A(object) if you're on python 2
@Aran-Fey LOL. partial credit
 
yeah now it correctly returns 'nah...'
 
wim
vaultah got the easy and "correct" way
 
Yay me
 
... is it possible to get the value of something in memory with its id(a.var) ?
 
8:18 PM
In CPython yes. There's some ctypes magic you can do
 
8:35 PM
wow, the cicadas are annoyingly loud tonight
 
.. is that a metaphor, or are you talking about live, lovely cicadas?
 
the latter
 
.. it's been some time since I've heard that. I know it's not your perception right now, but that sounds relates to calm and being relaxed, compared to my city noise
 
We have a bunch of cicada species here, they fly around all the time. But they're not very loud usually. Now this one has such a volume and a frequency that there's sweet deafening silence when it stops for a while.
I prefer the crickets...
 
8:48 PM
@wim: A.__dict__['__dict__'].__get__(a)
 
Nice
 
wim
@FĂ©lixGagnon-Grenier Is that the new Alien film..?
@user2357112 nice
inspect.getattr_static and inspect._shadowed_dict formalizes that idea
 
9:17 PM
@wim I'd be totally down for a alien-ish remake putting into light insects laying eggs into other species, with added gore and some cheezy love story
 
go go spider wasps and friends
 
what do you say, is this hammering correct: stackoverflow.com/q/38430277
@AndrasDeak well, in VN in April, omneg, literally deafening noise. Would have rather put my head into a jet turbine or sth.
 
I can imagine
@AnttiHaapala well the source seems much more well-defined and focussed than the target. The answer to the target sort of applies to the source question, but yeah, it's not a very good dupe I'd say
 
@AnttiHaapala Yes, but the question would benefit from a bit of editing.
 
my tesco fruit salad is frozen :F
ooo Scotland is trying to have a thunder :D
 
9:32 PM
what happened to your tongue?
 
well, not the same thing that happens to every kid in Fnland in winter at least once...
 
I think he meant the :F
 
those are fangs...
 
> MatLibPlot
good to know phyton will have its third-party libs
 
10:02 PM
@AnttiHaapala oooohhhh... yes indeed I meant the :F :)
I really love this new vampire smiley
"When all you have is otherwordly cunning, all you see looks like a laddah"
 
I have question. The op in question stackoverflow.com/questions/51547638/… posted wrong HTML and erased it - see comments under my answer. Should I undo the edit?
 
not necessarily. it doesn't look like they were trying to deface their question, and at this point (answer is accepted) it's unclear if it applies, or not.
I'd still format the html code so it looks like code
 
@FélixGagnon-Grenier yes, but without the HTML code the question is completely worthless (not that it is otherwise)
 
wim
anyone got a better way to do this?
>>> from datetime import datetime, timezone
>>> datetime.strptime('1970-01-01T00:00:00Z', '%Y-%m-%dT%H:%M:%SZ').replace(tzinfo=timezone.utc).timestamp()
0.0
there is '%Y-%m-%dT%H:%M:%S%z' but it doesn't work on python 3.6
needs to be stdlib only
 
@AndrejKesely it is (mostly) still there, except since it's not code indented the question looks like it's not
I formatted it correctly. Since it was not indented, the answer interpreted it as html
... but really that's.... a post on which we should stop investing time
 
10:12 PM
@FélixGagnon-Grenier thanks :) I agree with you
 
So, how much do y'all think I can depend on the repr of a list of strs not changing? I'm trying to automate setting up my desktop, and changing what's in the dock requires setting dconf settings, which uses the same syntax
 
I'd be more worried about the dconf syntax changing tbh
 
Yeah, you're probably right about that :/
 
10:39 PM
pandas dupe though it might need additional trivial ones :| stackoverflow.com/questions/51548344/…
 
11:24 PM
rhubarb
 

« first day (2840 days earlier)      last day (2094 days later) »