« first day (2826 days earlier)      last day (2108 days later) » 

7:00 PM
typo stackoverflow.com/questions/51312690/… with an upvoted answer from a 140k+ user :(
 
The OP is going vampire on him. Justice has been served.
 
That 140K+ user has posted more than a few bad answers over the past week
Not bad, completely incorrect
 
@Aran-Fey I doubt that's how it's goign to work
 
This is what we call syntax. — N. Wouda 1 hour ago
bahahaha
 
@PM2Ring Thanks for the response @PM2Ring, I have asked the question, but I guess the chat room has a rule that I can't post it here.
 
7:08 PM
@Aran-Fey I bet that comment would not be considered to be very welcoming. :)
 
aww i miss the conversation about Guido :(
I wanted to ask if Python is going down hill now without a head.
 
@KaranM That's right. If you still don't have an answer in 2 days, then you can link it here.
 
@PM2Ring Got it. Thank you!
 
@MooingRawr I'm pretty optimistic
 
@MooingRawr Yeah, the problem was too easy to solve :/
 
Vampire by feeding him endless points of +25
@vaultah I have a bad feeling about it....
 
Those 25 points will be deleted eventually
 
DSM
@Ffisegydd: it works in the debugger, though, and I've instrumented everything up to the pd.read_sql call.
python -c "import test_crazy; test_crazy.test_fizzy()" passes; pytest test_crazy.py fails.
 
My next step, which I'm sure you've thought of, would be py.test setup/teardown scripts. Maybe a missing teardown from a previous test?
 
@PM2Ring It was the perfect response to that question, I couldn't help laughing :D
 
wim
7:13 PM
anyone here good with bash
@AnttiHaapala crazy right?
I'm surprised Linus didn't flame him more for that ..
 
not the programming language, only the move :D
 
@KaranM Your question looks fine, so hopefully you will get some good answers. The one answer it has at the moment is not fantastic, there are more efficient ways to do that dictionary lookup. The good news is that you probably don't need regex for this. But I haven't got time to write an answer now: it's after 5AM in my timezone.
 
@wim because github was at fault :d
 
wim
in VAR=something cmd1 && cmd2 I want cmd2 to see var aswell
like VAR=something cmd1 && VAR=something cmd2 but DRY
current workaround spawns a subshell and exports, I'm sure there is something more bashthonic .. (export VAR=something; cmd1 && cmd2)
 
@PM2Ring I'm grateful that you went to check that question for me without me even posting the link here. Sure! In the meantime I'll try to figure it out by myself and see where I can get.
 
DSM
7:17 PM
AAAAAAAAAAAARRRRRRRRRRRRRGGGGGGGGGGGGGGGHHHHHHHHHHHHHHH
 
I show up to DSM yelling
things aren't good
what's happening
where is the bad person
 
@wim how about just VAR=something (cmd1 && cmd2)?
 
Here.
It me.
 
no :(
 
Distressed DSM is unsettling. Like a parent who doesn't know what to do.
 
wim
7:18 PM
that's a syntax error
 
that would define a function or sth :F
doens't work in zsh either
@Ffisegydd fizzyevil
 
u wanna talk about it DSM ?
 
That's a tautology.
 
@KaranM You can use the string extraction techniques we did yesterday. And then once you have the key part of the string use that as the dictionary key. Trying to do the dictionary lookup using the whole of self.name won't work: you have to give the dict the exact key, like 'ICS'.
 
@PM2Ring Okay, let me try doing that. and I will edit my post to make it more clear where you pointed out.
 
7:26 PM
I wanna know what DSM's issue was :P
 
You'll have to wait for post-op
 
I find it kinda ironic that a user use to answer low quality posts no matter what, and now they have a gold badge, they end up closing low quality posts. Maybe they were training to be a gold hammer wield all this time.
 
@MooingRawr I am so sorry :D
 
That's how you stay the 1%
 
not you silly :P
 
7:30 PM
1% 101?
 
= 1 rogar :D
 
I thought you got bored typing my name, but you mean "pray" in Spanish?
 
@wim I don't know that syntax. What does VAR=something cmd do?
 
Because I will absolutely take any upvotes on my content as 1 pray. I need all I can get. Feel free to share it for 100 prays.
 
@Arne sets an environment variable for only that one command
 
7:34 PM
Boo Antti'd
 
and shame on you for not knowing!!
 
Although I should probably check it it means "pray" as in prayer and not dinner for some animal
 
He's surely a win user
 
@roganjosh I was making a joke to this u typed 1% 101? and I was saying 1% 101 == 1
 
@AndrasDeak win loser!
 
7:35 PM
I gave up after scrolling through the first ~10 pages of this
 
@DSM seriously though you can't leave me hanging with that "ARRRRRRRRRRRRRRRGGGGGGGHHHHHHHHH". What was the issue?
 
@AnttiHaapala SO runs on win so we're all win users
 
I'm sure it's somewhere in there..
 
@MooingRawrok, so "rogar" really was you getting bored typing my name and not Spanish :P "rogan" might be closer, for future reference, lol
 
DSM was flung off the bridge into the eternal bog of darkness, after not answering the questions three properly
 
7:36 PM
Rogar Torgaryen
 
Andras must be loving this
 
@AndrasDeak The link to GoT is close enough that I'll take it as a compliment. I might even do a name change
 
oh I just noticed your name is rogan josh (one word) i thought that n was an r oops, sorry :\
if it makes you feel any better I did the same with AD, I just don't read.... :\ bad habit of mine.
 
:)
Andnas?
 
7:41 PM
one sec I'll go look up what I called AD.
 
@MooingRawr rogan josh
 
@roganjosh English is MooingRawr's first language, so you have to make some allowances for that. ;)
 
Which has absolutely no connection to me whatsoever other than it contains my name, Josh, and was a free chat handle back in the days of AOL. I prefer not to have to remember too many things, so I just stuck with it
@PM2Ring is or isn't?
 
Is.
 
Oh not this again PM. How many times do I have to say I'm sorry. :D
 
7:44 PM
My allowance, then, is that English is my only language :)
Although I can gesticulate and spout some random words in French.
 
How does one gesticulate in french?
 
@AndrasDeak from the neutrino announcement earlier, is there an analogy in understanding how that energy manifests that you can point me to? Baring in mind I'm an engineer, and thinking about it as kinetic energy of a bullet doesn't make sense since they're all travelling near the speed of light. Is it like temperature?
@KevinMGranger ah, the missing comma
Although I can gesticulate, and spout some random words in French.
 
Anyone got any recommendations for password managers?
 
I use a public Trello board
 
Hide in plain sight? Nice.
 
wim
7:58 PM
Passwordstate
Huh. Apparently, I created , just got a badge about it. Had no idea.
 
... so, sometimes, I'm happy, I think of butterflies, and stuff, and some other times, Purolator fails in delivering my motherboard, and I have to get it 12 hours later than I'd expected, and my life falls apart.
(╯°□°)╯︵ ┻━┻
 
we're here for you
 
thank you.
 
@roganjosh Sure, all neutrinos tend to get emitted with a speed very close to c, relative to the atom that emits them, and they don't interact very much so it's not easy to slow them down. But the neutrinos from the recent announcement are going at speeds that are ridiculously close to c.
Although relativity has a speed of light speed limit for bodies with non-zero mass, there's no limit to how high their kinetic energy or momentum can be. A more useful measurement than speed of such ultrarelativistic particles is rapidity.
@Ffisegydd I use a HMAC-like encoding of the site or page URL, using a simple JavaScript. This script was written by a long-time regular of the xkcd forum, who also happens to work for Google. The script uses SHA-1, but that's not as bad as it might sound, as the Wikipedia HMAC page explains.
 
8:17 PM
@PM2Ring so it's an exponential trend to infinity?
 
I remember you telling me your method a while back (well I'd forgotten but now you say it I remember)
 
Sorry about that. It's getting late.
 
I'm trying to think of a physical representation of the maths because my brain cannot work purely in equations if I can't visualise what's actually happening (it makes me incapable of understanding advanced physics, unfortunately:( )
 
@Ffisegydd I like being able to do my password stuff with a simple local script. It uses very standard JavaScript stuff, so it should run in any browser, including on your phone.
 
So, in my head, it should really hit you with the kind of impact of a cannon ball for the atom it hits, but presumably that force doesn't get propagated to surrounding atoms because we're mostly empty space?
I'm sure I just violated an awful lot of rules in quantum physics, but an analogy with caveats is better than pure maths for me to understand :)
 
8:24 PM
@roganjosh Well, it still has a lot less momentum than an actual cannon ball, but yeah, it packs a hell of a punch compared to a typical solar neutrino. And neutrino interaction cross-sections are really tiny, so they tend not to collide with anything. You could fire a beam of neutrinos directly at a beam of anti-neutrinos and they'd mostly just pass through each other, with maybe one in a billion (if that) particles interacting
 
@PM2Ring ok, that makes a lot more sense, thanks.
 
@roganjosh it really is like a bullet
 
I think it's a battle in my head of one thing tending to infinity and the mass of the particle being extremely low. We're still in the realm of the low mass dominating.
 
nothing tends to infinity
 
"rapidity takes a larger value, the rapidity of light being infinite." from the link I was just given
Umm, ok, I've misunderstood
 
8:30 PM
yeah, but light doesn't have mass
(rest mass, that is)
 
So relativity doesn't tend to infinity?
 
does not compute
 
I think I've watched too many YouTube videos trying to explain this that have muddled my mind
In terms of approaching the speed of light
 
"relativity" per se is a concept, so it can't typically tend to any real or other number
 
Yes, my choice of words there was poor, sorry
 
8:33 PM
no problem, but I have honestly no idea what you really wanted to say
 
That, if you have mass and approach the speed of light, your mass would eventually become infinite
 
but infinity is also a concept
 
@roganjosh yeah but "mass" is a silly concept like that. What really matters is moment and energy
@Aran-Fey so are there frames of reference where pinkness is democracy?
 
@roganjosh That's relativistic mass. But that's a confusing & misleading concept, so modern treatments of relativity don't use it. We just use rest mass, which is invariant.
 
I'm gonna go with "no" :D
 
8:43 PM
ooh, I missed this one
Nice: Python docs will change “generator expression” to “generator comprehension” https://mail.python.org/pipermail/python-dev/2018-July/154554.html (I advocated for this two years ago: https://nedbatchelder.com/blog/201605/generator_comprehensions.html)
 
I've only gone silent because I'm trying to digest this information btw. Thanks @AndrasDeak and @PM2Ring
 
no problem
 
wim
gencomp doesn't sound as cool as genex though.
quick poll: what does python3 --version say on your machine?
 
oh and 572 is officially accepted now
> Case in point: Guido found several examples where a programmer repeated a subexpression, slowing down the program, in order to save one line of code,
Guido found bad code so he made a controversial new python feature
@wim Python 3.5.4
 
Python 3.6.0
 
wim
8:47 PM
What I'm more interested about: is it just one line, or is there build info too?
 
3.7.0
 
@wim no, that's exactly it
 
wim
and when you just type python3 do you get the build info in the banner too?
 
yup, always
 
$ python3 -VV
Python 3.6.0 (default, Jan 25 2017, 01:06:17)
[GCC 4.4.5]
 
8:48 PM
$ python3
Python 3.5.4 (default, Aug 12 2017, 14:08:14)
[GCC 7.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
I've always seen that, both system and compiled pythons ^
 
wim
OK
in some cases I have seen also the build info shown in python3 --version. I haven't figured out yet what controls that at compile time.
any ideas?
 
wim
I guess
 
$ python3.7 -V
Python 3.7.0
$ python3.7 -VV
Python 3.7.0 (default, Jun 29 2018, 00:16:57)
[GCC 6.3.0 20170516]
could it have been that?
the parser increments a counter with each V github.com/python/cpython/blob/…
in particular, --version -V will also do that ^
the counter gets used in github.com/python/cpython/blob/…
and yes, it seems that 2 and above it will print the full build info
 
wim
huh
never knew that
 
9:00 PM
there's something in...ssh? where adding more vs will give you more and more up to 4 or 6 or something
Dec 2 '16 at 19:04, by Wayne Werner
-v for somewhat verbose -vvvvv for every possible thing
so...tar I think
oh yeah, but that's verbosity, not version, duh
 
huh, python -v is interesting
 
wim
python -v is really useful for debugging import problems
 
@PM2Ring demonstrated that feature already, but I was so oblivious that I didn't even understand what was going on. I thought that was a REPL
 
Python 3.6.3
@wim ^^
 
9:17 PM
Hi@ I was wondering if you know any guideline or document for scripting in python (or any language in general). I am looking for a trusted source to base my test scripts made on python. I have seen PEP 8, but I am looking for something more focused on scripting (structure, principles, etc)
 
define "scripting"
PEP 8 is a style guide, not more
 
Use an editor that supports catching PEP8 and linting violations
Or, use some python packages against your project that will do the same that run against your code to help structure it. That's pretty much it.
Beyond that, if you are looking for more overall design/structure, then you are more looking for general software design and best practices in that, which is not necessarily Python-centric.
 
can you give an example of the aspects of structure or the principles you're looking for a guide on?
 
@idjaw Could you name such an extension/editor. I could find that very helpful
 
9:34 PM
vim, interestingly enough, though I use PyCharm, and am also not idjaw
 
Very interesting thank you,
My question was not aimed at only idjaw ;)
 
The sad thing about PyCharm linting is that you can't give it your own
The one they built in is quite good though. If you don't have very specific style requirements you want to comply with it should be good enough
 
hey I have this code, but for some reason the console is printing output correctly, but the file, is created but just left blank... any idea what I've done wrong here?
last_value = None
    while True:
        sheet = client.open('Orders').sheet1
        cur_value = sheet.row_count
        if last_value is not None and cur_value > last_value:
            sheet = client.open('Orders').sheet1
            lastrow = sheet.row_count
            lastrowdata = sheet.row_values(lastrow)
            f = open('newrowdata.txt', 'w')
            print(lastrowdata)
            for item in lastrowdata:
                f.write("%s\n" % item)
        last_value = cur_value
        time.sleep(10)
so the console shows output (so lastrowdata has content in it) ; but when it's written to the file it's lost for some reason
 
Close the file before reopening in a loop. Use a context manager.
Also open it for append, or outside the loop
Unless you really just want the last batch of data
 
9:42 PM
@Gary What Andras said. Each time you do f = open('newrowdata.txt', 'w') you wipe out the existing file contents.
 
hey thanks, yes this is a temporary file i just want the last row data in it
i'll look into closing it, and into context manager, thanks
 
Don't know if opening once and seeking would work/make more sense
 
It's definitely more efficient to open the file once outside the loop than to keep re-opening it inside the loop.
 
The point of this file is that it will store the last row added to a spreadsheet, then I'm sending it to be printed ; and I want to repeat that process indefinately
ah ok i'll open it outside the loop
thanks
 
Also something something buffering
If you open outside you need to rewind it manually. And maybe flush before that (this might explain your lack of output)
 
9:47 PM
But if for some odd reason you do want to open a file in a loop then it needs to be closed before you open it again. A context manager simplifies that process.
@Gary That's a bit ambiguous. Do you want that file to just contain a single row? Or do you want it to hold all the lastrowdata rows that your while True: loop produces?
 
sorry for ambiguity, lastrowdata is a list that contains the value from every column of the last row added to a spreadsheet. I want the file to contain the data from that list. Everytime a new row is added to the spreadsheet, I want to overwrite the file with the updated data from that last row that has just been added
 
cbg
 
cbg
 
cbg
 
Also what Andras said about buffering. If a file is open for writing you definitely shouldn't try to read it in another process (and that includes printing it) . You need to close it first, so that the data gets flushed to disk correctly. You can also explicitly flush files with their .flush method.
 
9:54 PM
anyone aware of a bug with matplotlib where it traces from the end of a graph to the beginning and any workarounds (or what I might search for, as my Googling is failing me...)
 
if i'm closing it, each time I write to it, then I'll have to keep the open in the loop I guess?
 
@Gary Ok. In that case, it is simplest to open the file in the loop. But either close it explicitly, or open it using a with statement so it gets closed automatically.
 
@Gary what is your use case for this?
 
@AaronHall MCVE. I don't know of one
(or at least a figure)
last time I saw something like this, the problem wasn't even reproducible by OP
 
@user3483203 I'm sending the file to google cloud print api for printing. The file updates everytime a row has been added to a spreadsheet, and I want to print the new row data every time a new row has been added
 
9:57 PM
@Gary Are you printing the current version of 'newrowdata.txt' during that time.sleep(10). That sounds a little fragile...
 
i'm not printing it locally, but sending the file to an api
 
If it's possible you should try turning it into an event-base thingy. Publish changes when the data has changed.
 
but i can increase the timer if you think that could create problems
 
or will the data change on a 10-second time scale?
 
@AndrasDeak It probably has to do with the specific versions I have at work. I'm not sure you could recreate it. The problem is that you graph Xs and Ys with ax.plot and call show() and the graph is correct except for a line running straight from the end point to the start point.
 
9:59 PM
@AaronHall but what are the types of X and Y?
 
The point of the 10 second loop is that, everytime
'sheet = client.open('Orders').sheet1
 
that sounds as if the data itself were corrupt, with a jump in the first/last x
make sure the data is sorted according to x
 
@AndrasDeak I don't know how to describe that to find it with Google. Arrays and array-like lists.
 
@AaronHall sorry, I of course meant the contents of X and Y :)
 
is run, it refreshes the data from the spreadsheet, inside the loop i'm counting the rows, and if the rows have increased then I am writing to the file
 
10:00 PM
@Gary ah OK, right, I glossed over that detail, sorry
 
but when this is working i'll then add the api call underneath the file writing statement , and I think that should work ; but i'm no expert as you can likely tell !
 
@AndrasDeak float or float64
 
Then I'm pretty sure your data is off. Should it have been sorted with respect to X?
check again and let me know if the problem persists ;)
 
and I just tested it myself. In a notebook, it looks fine. In a popup from my IDE, same code, I get the line from start to finish.
 
With the same data? And is that dummy data or real?
check if the backend is the same in the two cases
 
10:05 PM
The notebook version is a little nicer looking.
Smoother?
 
anti-aliasing?
 
@AndrasDeak backend might be the issue. It's not an artifact of graphical smoothing though.
 
    last_value = None
    while True:
        sheet = client.open('Orders').sheet1
        cur_value = sheet.row_count

        if last_value is not None and cur_value > last_value:
            f = open('newrowdata.txt', 'w')
            sheet = client.open('Orders').sheet1
            lastrow = sheet.row_count
            lastrowdata = sheet.row_values(lastrow)
            print(lastrowdata)
            for item in lastrowdata:
                f.write("%s\n" % item)
            f.close()
        last_value = cur_value
this seems to be working ok now, i just added the close inside the loop ; is there anything glaringly bad about this code do you think? or ok to use like this would you say
 
@AaronHall yeah, it shouldn't be. But then it really is a bug, and it should be backend-specific, and knowing the backend should help you find the issue on github assuming it exists
also compare mpl versions
 
@Gary It depends on how the API call works. It probably reads the file into RAM & then closes it, processes the data & then uploads it. So even if there's a delay in uploading, or your network connection has a hiccup the printed data should be ok. But what happens if you lose your connection for 30 seconds? 3 updates will fail to get printed. Is that ok?
 
10:10 PM
@PM2Ring yes good point, thanks for pointing that out, i'll have to give that some thought
 
@AndrasDeak yes it's backend specific, they're different in the notebook versus my IDE. Looks like the problem might be a custom backend...
 
ah, tricky
 
But now I know where to look, thanks for the chat.
 
no worries
 
I think it thinks the graph is a polygon...
 
10:22 PM
Yeah, I got that. It closes the line. It's funny because I don't think pyplot has a feature like that
But IDEs can do weird things. I hope it's not spyder :D
 
nah, it's a custom one, but it's not the IDE, it's the custom backend.
 
11:20 PM
Does anyone know how to connect to a remote machine (as worker) with Dask? I haven't been able to figure it out. This is what I have in the scheduler and worker: ix.io/1d3y
Basically, an error distributed.client - WARNING - Couldn't gather 1 keys, rescheduling after gathering a result.
 

« first day (2826 days earlier)      last day (2108 days later) »