« first day (2054 days earlier)      last day (3121 days later) » 

00:07
@alecxe sure
trying to figure out tonight's arcade meetup details
@davidism there's a map, there's a time. How hard can it be? :-D
:D
rhubarb, guys
@MartijnPieters I didn't have the flyer but I figured it out.
00:54
In the last snippet of this SO answer, could someone explain to me what exactly is happening when there's no assignment? It says "if cur > best: starti, besti".. what does just putting a variable mean (i.e. what's happening to starti and besti) I don't know Python but am trying to understand the algorithm.
It's running
running?
It's returning those values.
Phone problems
No.. I'm not talking about the return statement.
    else: # reset start position
        cur, curi = 0, ind+1
What is happening to cur? curi is being assigned to 0. Actually don't know what's happening to ind either. ind = ind+1?
DSM
DSM
0 and ind+1 are both computed. Then cur is set to 0, and curi is set to ind+1
ind is not affected.
01:01
Okay I understand that curi gets set to (0 + ind + 1) and that ind isn't touched but why does cur get assigned to 0? Shouldn't it then read:
    cur = 0, curi = 0, ind+1
DSM
DSM
I didn't say that curi gets set to zero. It doesn't.
I'm talking about cur not curi. You said right there "Then cur is set to 0"
I really wish the OP would have used better variable names!!!
DSM
DSM
You edited your sentence on me. :-)
@DSM Because we both keep getting confused :)
So to get this straight, from what you said in your first message to me: cur = 0 then curi = (0 + (ind + 1)), right?
That's the non-python way of reading it?
DSM
DSM
There are only two statements: cur=0 and curi =ind+1.
The only quirk is that the right hand side is computed entirely before the assignment.
01:06
I guess I'm just confused how you go from cur, curi = 0, ind+1 to cur=0 and curi =ind+1.
I'm confused. Is CPython development work being done on Github, or hg.python.org, or a mix of the two, or what? I see pushes and PRs on github all the time, associated with actual github users, but the description still says it's a mirror. What's the deal?
Why not just write cur = 0, curi = ind + 1 @DSM
DSM
DSM
(a, b) = (2,3)
Instead of cur, curi = 0, ind+1
DSM
DSM
Because that's not syntactically valid, for starters.:-)
Do you see how the a,b example can only be interpreted in the way I'm saying the other is?
01:09
Because packing/unpacking is valid and convenient syntax.
I'm sure it is if you understand it @davidism
I'm asking why for my knowledge, not to argue the conventions
OH. I see what's going on now.
everything on the left = everything on the right
DSM
DSM
= isn't like in c where it has a return value. You can't put it in the middle of anything else.
YES @DSM
That was my confusion, because I'm using C
So I was like.. uh.. what's the point of just putting a variable name in there. What's it doing?
DSM
DSM
Three sports to watch and here and an errand is too much to try simultaneously. Rhubarb for all!
@DSM: By the way, your boss found me Sunday evening.
@DSM: I have the impression they are very very happy to have you! :-)
DSM
DSM
01:19
Heh. I wondered if you'd cross paths!
I asked if I know someone named <your full name here>. I gave a blank look. Then he said, you know, DSM?. Then a light went on!
DSM
DSM
Think I told you once my first name started with D. ;-)
And now I really do have to escape. Rhubarb for real!
How's PYCON, @Martijn?
@MattDMo awesome! So many old friends here, making new ones.
(the hallway track is my favourite part)
Also saw a very entertaining talk on github.com/llllllllll/codetransformer
01:28
That's cool. I really wish I could have come, but being unemployed at the moment put a crimp on my traveling across the country for fun.
 
3 hours later…
04:05
Cabbage :-)
04:21
Morning
what arguments to slice() should I use to represent a slice like arr[3:]
slice(3, None, None), I guess
04:35
slice's other arguments aren't required, are they?
slice(3) represents [:3]
You can omit the second None, though: slice(3, None)
 
3 hours later…
07:12
Cabbage
07:42
No MCVE (really, the question doesn't even sort and otherwise is a big mess anw). Error in writing files - Rachel - 2016-05-26 23:59:26Z
Too Broad Parallelizing a program in Python - Denis Kulagin - 2016-05-29 13:58:12Z
08:33
Interesting! zip(count(), a, b) appears to be faster than enumerate(zip(a, b)). At least, it is for me on Python 3.6. I'm using pairs of identical int lists for a & b, but that shouldn't make a difference. My test code is here: pastebin.com/8M9Jshy7
How much faster?
The weird thing is that in some tests the speed difference is around 10%, but in most runs it's in the 30-50% range.
I wrote that code in response to this (closed) question: stackoverflow.com/questions/37538763/…
@PM2Ring tuple
one creates 2 tuples, one just 1
so no wonder
Oh dates in Javascript. Is there anything worse?
@RobertGrant dates with python are almost but not exactly as horrible as dates in javascript
@RobertGrant use moment library
08:47
I do use moment :) Just wish I didn't have to
And I can't use it here
@RobertGrant but moment is better than datetime, which is pretty damn broken with timezones
@AnttiHaapala Yeah, I was thinking that the extra tuple manipulation may be the main cause. FWIW, I just did another run, and for some lists enum_zip was the winner, but only by 5% or so.
@PM2Ring it depends on how much you've allocated memory and such things
anyway I'd expect zip+count be always faster with large numbers
So it looks like "flat is better than nested" is the winner here. :)
@AnttiHaapala Both commands, use zip, but one uses count, the other uses enumerate.
ah yes, s/zip/no-enumerate/
08:50
[(i, u, v) for i, (u, v) in enumerate(zip(a, b))]
[(i, u, v) for i, u, v in zip(count(), a, b)]
also, new int creation is slow as well
@PM2Ring that your tested code?
@AnttiHaapala But don't count & enumerate both have to do the same work in creating new ints.
lol, it seems Mikko's chocolate didn't soften Martijn, or he's having a hangover there :d
@AnttiHaapala Yes. See my pastebin link above for the full code. Note that I create the a and b lists outside the timeit tests and import them in the setup.
@PM2Ring yeah they do, but just to say why the timing differences might come from
08:54
@PM2Ring have you tried disassembling the list comp code objects? You'd see what antti's talking about (among other things): 2 UNPACK_SEQUENCE vs. 1 etc.
I wanted to do semi-realistic tests, which is why I put the loops into list comps, rather than having normal for loops with a pass stmt, as in the OP's code. But I guess I should see what the times are like doing it that way, too.
@IljaEverilä No, I haven't used dis on this stuff. But I'm aware of the extra packing & unpacking that the enumerate version has to do.
Ok. Just doing normal for loops with a pass stmt, I get zip_count being 30-50% faster. But I just thought of something. Maybe the timings are so variable due to delays caused by garbage collection of the a and b test lists. Does that make sense?
Hmmm. If I run the outer loop backwards I get more consistent result. zip_count is still the winner, but now the margin is 16-20%. I'm going to try pre-computing all the lists.
Hang on. "By default, timeit() temporarily turns off garbage collection during the timing. ". So GC shouldn't be an issue...
09:11
hello. Can I have a list of tuples like this?
foo = []
foo.append(("myfile", (2, 4)))
and then iterate over it like this?
for fn, lines in foo:
for L1, L2 in lines:
doSomething(fn, L1, L2)
I can't do indentation apparently
@Qsiris You need to click the Fixed Font button or select your text and hit Ctrl-k. You can edit your post, if you're quick. Just hit the Up arrow.
I tried and failed.... too late now
foo = []
foo.append(("a", (2, 4)))
foo.append(("b", (6, 8)))
for fn, (L1, L2) in foo:
    print(fn, L1, L2)
output
('a', 2, 4)
('b', 6, 8)
so I can't get them in the second for? why not?
I want to understand
Think about it
A tuple is a sequence
09:19
yes, but if one element of that tuple is another tuple?
A tuple (2, 3) is a sequence of integers, so if you do for L1, L2 in lines:, you're trying to unpack something from a sequence of integers.
@Qsiris If you want to do doSomething(fn, L1, L2) then you need L1 and L2 at the same time. If you have a nested loop then you'd get L1 and L2 one at a time.
why do I have to unpack it at thte same time with the main tuple?
ahaaaa
I get it
Because a, b = 2 does not compute. And you don't have to, it's just handy.
You could do this:
foo = []
foo.append(("a", (2, 4)))
foo.append(("b", (6, 8)))
for fn, lines in foo:
    for L in lines:
        print(fn, L)
Which prints this:
('a', 2)
('a', 4)
('b', 6)
('b', 8)
09:22
so I would need a dictionary to be able to use it the same
@Qsiris No, you (probably) don't need a dictionary. :) What are you really trying to do?
I have a list of file, from which I must extract lines, or line parts. And I have 2 lists of regexes: for full lines, and for line parts
if the current file matches, check the regex for full line, and then for line part
and extract
I append to the list with:
foo.append(("filename", (fullLines, lineParts)))
and then do:

    for fn, lines in foo:
        if fn == fileName:
            for fullLines, linePart in lines:
                 do The extraction
I can't figure this fixed font thing out
def _stripLinesToBeIgnored(self, fileName, lines):
        for fn, ignoreLines in self.linesToIgnore:
            if fileName == fn:
                for ignoreLine, ignoreLinePart in ignoreLines:

                    ignoreLine     = re.compile(ignoreLine)
                    ignoreLinePart = re.compile(ignoreLinePart)

                    for index, line in enumerate(lines):
                        if re.fullmatch(ignoreLine, line):
                            lines.remove(line)
                        lines[index] = re.sub(ignoreLinePart, "", line)
the received lines is a list of the lines in the file
Green Bean Cabbage Hi Peaches and Pears. Just watching the discussion. Feeling Bananas having finally found a question I could offer an answer to. Artichoked that I found one. Nearly to 50 reputation, then I can comment also. (Not sure if Salad language is still popular in this chat, but hey, what the Laurel!)
@Qsiris You can't mix normal text and formatted text together in one message. It's either all normal, or all formatted. In normal text you can use backticks ` to put single line stuff into a fixed-width font, and you also can use _, * & --- for style commands.
then how did you send that so fast?
do you type like Flash?
09:33
One _ or * gives italics, two gives bold, three - gives strikeout.
anyway. Do you think I should use a dictionary for my case?
@Cam_Aust To be honest, we don't use salad much here these days, and a couple of the regulars don't like it at all. We mostly just use "cabbage" or "cbg", "rhubarb" or "rbrb", and "yam". "pineapple" and "melon" get a bit of use. Oh, and of course "garlic" comes in handy too.
Chuckle, thanks for that. As I suspected. Ta.
Cabbage!
09:48
@Qsiris Ok. I haven't done a deep analysis of your code, but I've spotted one major problem: lines.remove(line) Firstly, the list .remove method is slow because it has to scan through the list looking for the thing to remove, and if there are duplicates it will remove the first one. If you already have the item's index it's much better to do del lines[index].
However, removing items from a list you're iterating over is dangerous, it's a bit like sawing off a tree branch that you're sitting on. :) The usual technique is to build a new list, copying only the items you want to keep to the new list.
and if the list is humongus?
@Cam_Aust I looked at your answer a couple of minutes ago. There's some good advice there. But it's tricky when the OP doesn't supply all the info you need. And it's frustrating when you can't write comments to get that info. Hopefully, the OP can save their files as plain text rather than as .doc or .docx, since processing such things is tricky, to say the least. So I guess you need a few more points so you can write comments. :)
@Cam_Aust: BTW, you can pick up a couple of points by suggesting edits, if those edits are approved. That question doesn't need much editing, but there is a grammar error you could fix, and you can capitalise Python. And you can get rid of "fluff" like that closing " I am also a beginner so if you could please explain it to me that would be great." sentence.
When you suggest an edit please try to fix everything you can, since 3 people need to approve your edit, and it's wasteful if the same thing needs to be edited multiple times.
On a call back soon.
09:58
@Cam_Aust Rightio.
@Qsiris Well, once you've copied the stuff you need to the new list you can replace the old list with it, which will free up some RAM. But if the file is huge then it's generally best to organise your logic so you can process it a line at a time rather than reading the whole thing into RAM.
in [l.replace('\\', '/') for l in open(expectedFile).readlines()] can I call a function that might not return anything, thus not adding an element to the list?
FWIW, here's a quick demo of the dangers of removing items from a list you're iterating over:
a = list(range(10))
for i in a:
    #Attempt to remove low items
    if i < 5:
        a.remove(i)
print(a)
[1, 3, 5, 6, 7, 8, 9]
cabbage people, is that me or those eval answers are not even supposed to work? stackoverflow.com/questions/2083140/…
10:20
@davidism strangely addicted to gurren lagann
Even though the answer to every episode's problem is the same
@bereal All those answers are rubbish.
Let's see what inspectorG4dget has to say for himself. :)
@Qsiris All functions in Python return something. If a function completes without hitting a return statement it's the same as if it hit a plain return, and that's the same as return None.
10:42
@Qsiris where in that expression do you want to call that function?
@Qsiris BTW for line in open(expectedFile) is better than for line in open(expectedFile).readlines(). The first version iterates over the lines one by one, but the second version has to read all the lines into a list and then it iterates over that list. However, it's better not to open files like that. Use a proper with block, eg with open(expectedFile) as input_file:
Ok back from conversation with the ex-lovely over young out in the world son having normal life learning issues. PM 2ing, thanks for your feedback. Much appreciated. And yes, that is why I am counting down to 50, so I can comment. OK, and your comments on suggesting edits is good to know. I did think to correct that first typo. I was not aware I could suggest edits. I'll have to go back and look for that. I have edited one tag so far, and approved.
Robert Grant, I think they are talking about how Python is processed and executed behind the scenes. It does help to know, and helps you write Python code with better clarity and sureness of outcome - or that is my sense of it.
11:11
@RobertGrant I haven't read that whole thread, but if it's any consolation, I agree with what you said, and I don't agree with domenic's perspective that browser behaviour should dictate standards. Sure, browser vendors have a lot of power in determining what happens on the Web, but letting them set the standards has a bad track record.
Thanks :)
@Cam_Aust huh?
Oh I see :) I said that as comment on the page that I linked to :)
@Cam_Aust That conversation that Rob's involved in isn't about Python, it's a more general discussion about standards for what URLs should be considered valid.
OK ta both. Yes, I can comment now. Progress.
Allowing malformed URLs to be repaired sounds like a disaster to me. Sure, minor repairs may be ok, but more radical mods could create backdoors for all sorts of scamming.
(Over 50 points - cool.)
11:15
I included "Overton Window" for kevin's benefit
@Cam_Aust You're welcome. :)
OK, found the @ sign to respond to individuals in this Chat. I have been looking for a bit of write up on shortcuts etc relevant to this chat environment. Is there one. I may be about to be red faced, but I have not located it. Can someone direct me to such if it exists.
I hate Instagram
@Cam_Aust FAQ link in the bottom right
It isn't very visible
worst API ever.
11:21
@RobertGrant Thanks, got it!
@RobertGrant There is? That's invisible in this old Firefox, running on a 1024x768 monitor. The last line I can currently see in the sidebar is "starred show 9 more / show all 1831". If I hit F11 I can see down to "enable desktop notification", but still no mention of a FAQ.
Under the SO logo, on the right of your text input?
@RobertGrant There's nothing there. But I can get to the FAQ via the room info link.
Ah. If I reduce the width of the textinput then I can see help | faq | legal | privacy policy | mobile. Yay!
11:32
Ah :)
Yeah it is a weird width, the input box
And wow yeah, just pushes the content sideways!
Guess that's a browser implementation thing
I think the close-vote helper script I use might be the culprit, since it adds a couple of extra buttons to the "send", "upload" button collection.
FizzyBob consulting will fix that for you for a low low price
cabbage
@RobertGrant :) Pity I can't set this monitor to a higher resolution.
@RobertGrant seeing your name with highlight is confusing
11:36
FizzyBob consulting will write you a script which will highlight either Fizzy or Bob for you always, so that if the one you choose pastes a screenshot into chat, you won't be surprised. For a low low price!
@Cam_Aust you should also read how comment replies == pings == @ mentions work on the main site
Naming things is hard. Case Instagram API. The word "next" means "before in timeline" and "prev" means "after in timeline"
@AnttiHaapala That's just batshit insane!
because...twitter streams are upside down?
11:37
It's like when you click the previous search results link in google, and then hit the back button, which takes you forward in the search results
it is because "the foremost page contains the latest media"
Ok. I guess that kinda makes sense. It's still batshit insane though. :)
then "next results are before in history"
It's a dumb name when your results are intentionally ordered backwards
of course now that I went to shout at them for not supporting Python 3 in their python client,
they now have stopped supporting Python altogether.
no more official instagram api client
11:38
Did they open source it?
> This project is not actively maintained. Proceed at your own risk!
https://github.com/facebookarchive/python-instagram
and... ewll, it turns out, everything in that client is br0ken
> The Stack Overflow community is a great place to ask API related questions or if you need help with your code. Make sure to tag your questions with the Instagram tag to get fast answers from other fellow developers and members of the Instagram team.
every single api method can now throw exceptions
^the above excerpt can be read as: "f**k you developer community and especially Stack Overflow"
And why we have to deal with this... the coming API changes tomorrow were somehow unexpected to our data provider :D
11:40
I suppose it's a bit like when we say "We need to move the meeting one day forward" we have to subtract 1 day from the original date to get the new date.
> min_tag_id Return media before this min_tag_id.
max_tag_id Return media after this max_tag_id.
It's ever so much fun that those parameters change name from API endpoint to endpoint
@AnttiHaapala Sorry, that's just the way English works, Antti. :) Moving a (future) event forward moves it closer to now, moving it back moves it further away from now and thus further into the future.
That was recent media for tags, recent media for users uses min_id and max_id. With completely different documentation.
@PM2Ring however, these are for events that occurred in the past already.
11:46
In Discworld the trolls say that we're all actually traveling backwards in time because we can see where we've been, but not where we're going.
I assume those were trolls living in a very cold place
@AnttiHaapala I agree that it's ambiguous, so I generally avoid using that construction myself.
@AndrasDeak Indeed. The old troll philosophers up in the mountains are a bit sharper than those living down on the plains. :)
i have tons of question to ask from a python programmer
please reply so i can go on my question
good luck finding one
11:58
No.
@Rana please read sopython.com/chatroom first.

« first day (2054 days earlier)      last day (3121 days later) »