« first day (2134 days earlier)      last day (2828 days later) » 

8:00 PM
or something
yeah I think I'll just make the situation worse
 
Here - look at this Andras - this is you, this is
 
Huh, yeah, it creates an infinite dictionary.
That is super weird.
 
@JRichardSnape woooow that's an awesome pattern!
 
DSM
@AndrasDeak: aww, we could have gaslighted (gaslit?) him for a while..
 
gaslitten?
 
8:02 PM
@MorganThrapp it's probably something like x,y = {},4, but then x[4]=x,4 and there starts the rabbit hole
 
Yeah, that would make sense.
 
ya, so it resolves from left to right? thats strange. Why? I would expect right to left
 
user559633
Hah, that's cool.
 
@NickHumrich I think I saw something with a=a[0]=... or similar, I'll try to find it
I guess the regulars would find it faster
 
Doesn't Python always resolve left to right? That's why x, y = y, x works.
 
8:04 PM
@DSM :(
I suck
 
Isn't x[y] = {}, 4 not a normal assignment though?
It's more like a function call right?
I'm not up to speed on my dunders.
 
@QuestionC why?
x[y] = (tuple here)
it mutates a dict
 
quicktime's screen recorder is awesome.
just delivered a demo to my PO. Story complete
 
I think I understand that line now, with the x and the y.
 
found "it" @NickHumrich
@JRichardSnape the funny thing is that I don't see anybody else with a remotely similar avatar here, so it can't be a simple case of mistaken image
 
8:11 PM
@DSM I'm proud of your thinking there. I was mentally preparing for "what, that's just the same as ever"
 
at least not within the room
 
God this is confusing
 
@idjaw I keep reading PO as parole officer - what have you done now Cap'n? :p
 
he played football
 
@AndrasDeak No - It's definitely re-calculated for some reason. And Kevin too (hence my opening remark), but not DSM.
 
8:11 PM
he's on his second life sentence now
 
@JonClements Not allowed to speak about it until after the trial
But I'm not allowed back at KFC.
 
Kanadian Football Club. Told you.
 
@idjaw That doesn't seem much of a punishment :)
 
@JRichardSnape DSM has a custom avatar from imgur, it's only apparently a gravatar
compare this with this
 
8:15 PM
@JonClements yeah...good point...
 
look around at meta, maybe submit a bug report
 
@Ffisegydd Is that a mogwai/cat half-breed?
 
I would do a git blame and go kick someones ass if i saw that (x,y) = x[y] ... crap
 
No idea
 
@AndrasDeak Mmm, I suspected as much
 
8:16 PM
I swear we've had this issue in the past.
 
I seem to recall a Raymond Hettinger tweet similar to that (x,y) = x[y] ...
 
With gravatars changing for certain users.
 
I dont know who Raymond Hettinger is ... I guess ill ask the oracle
 
If I log in tomorrow and it's there I'll try to chase it a bit. Then it will turn out to be a heisenbug.
 
Python Core Developer/Manager/whatever.
 
8:19 PM
yeah i would have to probably murder a team member if i found that crap in our codebase
 
What about avatars? Puppy confused...
 
@JonClements they are mixed up on chat. And Area 51!
but only the identicon ones
 
oh hadn't noticed...
 
@JRichardSnape ^
the top one is my unsalted identicon, that should be the big one as well
it wouldn't be suspicious if it weren't for your chat bug
But I see the identicons properly in chat:/
maybe the area51 is something else? would be odd
I can't see any bug reports along these lines...maybe you should submit one
 
@MorganThrapp actually x, y = y, x would work if it was left to right or right to left. It only matters if you have more than one = sign
 
8:28 PM
Oh, right, duh.
 
@AndrasDeak thanks for the link. It lead me to the docs which validates the left to right thing
 
8:48 PM
Alright all. Have a great weekend. If things work out, @tristan I might be able to show up to the stream. Still don't know what's planned this weekend.
cheers all
 
I might have remembered a = a[0] = [[]], a quick way to create a recursive list
 
DSM
Good idea. Rhubarb for all!
 
rhubarb, gents
 
user559633
@idjaw Sounds good, that would be fun.
 
user559633
Have a good one for those of you that are taking off
 
9:01 PM
@ThiefMaster you're right, that for - if should be a for - else for clarity:P
 
wim
9:13 PM
ewww.
 
github.com/indico/indico-plugins/commit/… - my beautiful workaround for it ;x
 
@ThiefMaster hair of the dog
@JRichardSnape further development: compare the URL here and the URL here. The only difference is the requested size of the identicon. The former is a tiny one, that's what it should be. If you request a larger one, it changes.
purely gravatar issue, it would seem
 
9:29 PM
@AndrasDeak I'll submit a bug if it persists tomorrow (it's late now). Looks like gravatar, but hard to track. Your two different URLs from previous message look the same to me (like your incorrect area 51 avatar, at two different sizes). Looks like they've got some weird problem.
 
interesting...the smaller one for me is like the tiny icon on top the area51 page:S
must depend on the watchamacallits...servers
blame caching?
 
Always the best problems - different for different users in different ways.
Caching.
Definitely Caching ;)
G'night...
 
good night:)
 
user5077886
10:03 PM
cbg
 
user5077886
anyone here?
 
cbg @Ciitk34
kind of :P
 
user5077886
10:19 PM
just had a quick question
 
user5077886
i have a file with numbers in different lines. i read it through readlines() and then try to remove the trailing '\n' from each using for b1 in b: b1=b1.rstrip('\n')
 
user5077886
why does it not work?
 
user5077886
the list b still contains elements with trailing '\n'
 
user5077886
@WayneWerner
 
readlines strips newlines itself (read() leaves them but also returns as on long string (if I recall)
are you doing with open('/your/path/file') as f: my_lines = f.readlines() to read the file?
 
user5077886
10:26 PM
i am doing as b=open(path).readlines()
 
user5077886
and then when i print b, the elements still has '\n'
 
okay, before I get into an XY problem: any reason your not opening with with?
 
user5077886
sorry, but i always do it this way
 
user5077886
and i tried the with, it is the same output.
 
user5077886
the list elements have '\n' attached
 
10:33 PM
what did you try with with? which handles safe opening and closing of files btw
 
DSM
Brief in-between cabbage.
 
user5077886
i tried opening the file with `with` the way you suggested - `with open(path) as b:
mb=b.readlines()`
 
DSM
@Ciitk34: b1 = b1.rstrip("\n") doesn't modify b in any way, you're just saying "make a stripped version of b1 and bind the name b1 to it."
 
user5077886
am i not modifying b1 ?
 
DSM
b1 is a name. It used to point at one string. Then you make a new string and point it at that. The list named by b isn't changed.
 
user5077886
10:39 PM
my line of thinking is that the list b has some elements and when i do for b1 in b: b1=b1.rstrip() , each element of b is rstripped. where am i wrong?
 
80
Q: Getting rid of \n when using .readlines()

TDNSI have a .txt file with values in it. The values are listed like so: Value1 Value2 Value3 Value4 My goal is to put the values in a list. When I do so, the list looks like this: ['Value1\n', 'Value2\n',.....] The \n is not needed. Here is my code. t = open('filename.txt', 'r+w') contents =...

 
DSM
Say you give me a bag full of apples one by one, and before you hand it to me you put a sticker on it. Then I take that sticker and put it on something else, say a pear. At the end of that, you still have a bag full of apples.
@JGreenwell: I was going to recommend the with + listcomp approach, which I see is listed there.
In the above analogy, b1 is the sticker you put on the apples in the bag/elements of the list.
 
yeah, was why I asked about if with was used - but then wife wasn't feeling well and kids demanded chocolate milk :)
 
DSM
For example, at the end of this loop, x isn't modified:
>>> x = [10, 20]
>>> for i in x:
...     i = i + 10
...
>>> x
[10, 20]
even though the sticker i is now on the new number we made:
>>> i
30
 
user5077886
so you mean i 'can't' modify a list but i should created a new list with the modified elements?
 
DSM
10:47 PM
You can modify a list, and you can even modify elements of a list (sometimes, if they're mutable), but you can't modify a list by rebinding names (moving stickers).
For example:
>>> x = ["a", "b", "c"]
>>> for index, element in enumerate(x):
...     print(index, element)
...     x[index] = element * 5
...
0 a
1 b
2 c
>>> x
['aaaaa', 'bbbbb', 'ccccc']
You could modify a list by index, using x[index], because that tells x that you want to modify its index-th element.
And if a list has mutable elements, such as lists, you can modify those too:
>>> x = [[1,2],[3,4]]
>>> for sublist in x:
...     sublist.append(99)
...
>>> x
[[1, 2, 99], [3, 4, 99]]
 
@Ciitk34 here's another more concrete example:
    In [12]: x = [10, 20]
    In [14]: for i in x:
    ...:     print(i, id(i))
    ...:     i += 5
    ...:     print(i, id(i))
    ...:
10 140378562745184
15 140378562745344
20 140378562745504
25 140378562745664
different ids, different objects
 
user5077886
@DSM, i am confused that you said that only the label i changed in case of i=i+10. why dont we use the same argument for sublist? isnt it also another label?
 
user5077886
@WayneWerner, thanks!
 
You're never re-assigning to it
i.e. you don't do sublist = sublist.append(99) (which actually returns None, so that'd be useless)
 
DSM
name = something_or_other is a rebinding operation. You're not actually involving the object named by "name" at all.
 
10:56 PM
if you did sublist = [42] + sublist though, for instance, you'd end out with the wrong thing again
 
user6568562
@Ciitk34
 
user6568562
 
user5077886
ok
 
DSM
sublist.append, on the other hand, asks the object named "sublist" to do something. x[index] = something basically calls x.__setitem__(index, something), and so again asks the object named by x to do something.
 
user6568562
name == identifier (pointer, reference)
 
user5077886
11:00 PM
thanks a lot guys, very helpful. made things clear
 
user559633
11:57 PM
 

« first day (2134 days earlier)      last day (2828 days later) »