« first day (2328 days earlier)      last day (2637 days later) » 
00:00 - 17:0017:00 - 00:00

5:00 PM
>>> x = [["0"]*2]*2
>>> x
[['0', '0'], ['0', '0']]
>>> x[0][0] = "1"
>>> x
[['1', '0'], ['1', '0']]
 
I have to admit, I rarely use list/string multiplication. Let e play with that
Ah
 
DSM
I'm on record as having my doubts about whether list multiplication was worth the headaches it causes newbies.
 
Question for you folks who like Pandas. Is there any particular reason why DataFrame.expanding() doesn't (or does and I'm doing it wrong) support multiple agg functions?
 
I think I am too. Or maybe I just quietly agreed with you when you went on record, and misremembered it as me being on record.
 
For example, if `temp` is a column of values, this doesn't work.

`df.groupby('location').temp.expanding().agg(['mean', 'std'])`
 
5:02 PM
@DSM I'd argue in favor, only because it's surprising once but you tend to encounter it at the beginning of your Python career and it exposes some realities of Python that might otherwise be glossed over that could cause real headaches down the road.
then again, I practically never use list multiplication, so there's also that...
 
@Tokencodingnewbie What Wayne said. It's just a convention to indicate that you aren't going to use the loop index variable. It might look weird if you aren't used to it, but underscore is a permitted character in a name.
 
and it probably benefits code golf :D
 
yeah, that issue comes up especially when you're trying to make matrices for the first time in Python
 
^ Also my apologies for not being able to format code here, someone needs to teach me :(
 
When I make 2d lists I prefer to do x = [[default_value for i in range(width)] for j in range(height)] rather than x = [[default]*width for _ in range(height)] because I think the first way looks more homogeneous.
 
5:05 PM
Same
 
@Mitch Most markup syntax, including backticks, doesn't work for multiline messages. If you had put your code as its own message, it would have worked.
 
DSM
@Mitch: I can't see any reason for it. Just an oversight (and it's not expanding-specific, same problems hit rolling). On this I can speak for Jeff -- PRs always welcome. :-)
 
But it's no big deal because it's still legible even without a monospace font.
 
Heheheheheh.
Think of it this way - if you're in a taxi, and you're approaching a junction, the driver normally has to choose which way to go. But if an asteroid falls out of the sky and hits the taxi just as the driver is deciding, the taxi is blown to bits and you don't go down either road. 1/0 is an asteroid. — Zero Piraeus 3 mins ago
3
 
DSM
Lunchtime rhubarb for all (nothing personal, Zero, just bad timing :-)
 
5:09 PM
@DSM I will never speak to you again.
 
@ZeroPiraeus That's a delightful explanation. I think I'm going to steal it
 
You're welcome :-)
 
@Kevin Thank you! I'll keep that in mind.
And @DSM I appreciate it, at least I know I'm not missing some syntax nuance. Thanks!
 
@WayneWerner yup. Seconded for stealing. Thanks @ZeroPiraeus
 
@Kevin Fair enough. I like doing it with list multiplication because that does the looping at C speed. Of course, you do need to make sure you only do it with a list containing an immutable item. :)
 
5:16 PM
Luckily my 2d lists tend to be small enough that the speed difference is negligible. I guess the highest I've gone recently is appx 500x500, when I needed a buffer for pixel data.
If I needed something really huge, I'd probably use numpy, which I understand is all the rage with kids these days.
 
Rhubarb
 
I can vouch for numpy, it's hip and whoo and ungh
 
5:35 PM
@PM2Ring so _ is just like just using x for a fast variable that doesn't need a complex name?
 
yeah, it's a regular variable, but it's common to call it _ if it appears only in a single place inside a list comp or a for loop
if you're using it later, give it a proper name
so [[0] for x in range(3)] is equally fine, but [str(_) for _ in range(3)] is a no-no
it's just convention
 
Also common if something returns a tuple and you don't care about one of the values, e.g.
for root, _, files in os.walk(path):
 
Ok first time I've ever seen it used before, makes sense now thanks.
 
Somewhat obscure fact: in the REPL, the variable _ gets automatically assigned to the result of the last evaluated statement.
>>> 23 + 42
65
>>> _ - 1
64
>>> _ - 1
63
>>> _ - 1
62
>>> _ - 1
61
 
I wasn't going to note that for fear of confusion
(the result of the last evaluated statement unless it's None, right?)
>>> 3
3
>>> None
>>> _
3
 
5:44 PM
Confusion's good for you. Lets you know your brain is still operating.
If you have no questions about the world, you might be dead.
8
 
6:06 PM
Random thought: if Python had augmented unary operators, would they be postfix or prefix?
 
Isn't there ~?
 
Yeah, so would it be x~= or ~=x or =~x or what?
 
oh please no
 
So you're asking, a+b is to a+=b as ~c is to ???
 
Yep. And, to answer your second question, yep.
 
6:09 PM
I suspect x~= would be easiest to hack into the existing parser
 
Oh good. The CEO's AMA is so popular within the company it overloaded the internal wiki-thing. Guess I have to do real work then :/
 
Actually, I changed my mind. I think any way of implementing it would be equally difficult. I thought each existing augmented operator had its own grammar rule, but it turns out they don't, so you're going to have to create a whole rule for unary augmented assignment no matter what.
 
nevermind, I misunderstood
 
Why would I ever want to learn java when I simply could use Transcrypt (write it in python and convert it to javascript)
Source: http://www.transcrypt.org/
 
Well, for one thing Java != Javascript.
Also, transpiled languages can bring problems with them in terms of maintainability and speed.
 
6:23 PM
that's a good reason ^ (the JS!=java part)
 
Oh yeah, that right :P
that's*
 
and there is so much more to why that is not a viable solution for delivering production grade web applications
 
@SebastianNielsen you can edit messages
 
@SebastianNielsen You had me at "Why would I ever want to learn java".
 
@ZeroPiraeus so you can take up a job using c# /s :D
 
6:25 PM
@davidism it faster to simple my way
 
wrong response
 
But I mean if I could just convert the python code to java. That would be amazing.
 
@SebastianNielsen it adds an extra line to the chat :( imagine if everyone did that.... how much spam would we have?
 
"spam"
 
@SebastianNielsen I'll put it this way: edit your messages instead of doing what you currently do.
 
6:26 PM
just convert the code to the other code to do the needful
 
@davidism yes sir.
 
 
button should say "needful now pls"
 
@SebastianNielsen Even better, just write Python and run it on the JVM
@AndrasDeak "I'm in a hurry"
 
If only python 3 could run python 2, amirite?
 
6:29 PM
Run Pypy with Jython so you can :D
 
"Why would I ever want to learn Java[Script]?" So that you know it and understand what your magic transpiler is doing, so that you can operate with the rest of the JavaScript world.
 
in order to make everyone happy, we will make everyone equally unhappy
we are all doing PHP now
 
we just want to watch the world burn
 
@WayneWerner Get those dollar signs out...it's world burning time.
make it $rain
 
6:30 PM
@idjaw The geese are back. I went out for lunch, and as I was leaving the office's doors, a geese behind me quacked so loud, I jumped :( It then made a smug face at me as it sat back down waiting for his/her next victim. :(
 
Geese bite hard. Source: soccer teammate that was teasing geese and got bit
 
they are as evil as koalas :(
 
Source of all of my Koala Knowledge: youtube.com/watch?v=HTdOQjmbAHY
 
Geese are the only mean canadians.
 
I love koalas, they are cute :#
 
6:37 PM
@KevinMGranger Oh yeah? Explain Labatt beer, then.
 
What's wrong with it?
 
What's wrong with Labatt beer?
The fact that it's called beer
 
Wow, Stockholm Syndrome ;-P
 
I'm not Canadian. I don't have any problem with it, it's not worse than any other macro-swill
 
Koalas always seem to me like the slow killer kind (when they're not pouncing from trees, that is). Their slow speed just makes me think that their jaws work like pneumatic cutters. I imagine it like this: they only bite if you put your hand in their mouth, but then say goodbye to your fingers.
 
6:47 PM
daaawwww love from puppers is great love
 
every Australian I've met, hates koala .... so much
@idjaw stop stalking me :( How did you know I was browsing r/aww. posting a comment hinting to me that you know what's up while making me seem crazy to the public when I ask you about it :\
 
That mod comment is great. It's the only thing I know about the /r/aww community now.
 
sorry for the question out of the box ...


Hi can any one tell me what is the issue with git send-mail i am getting following error and there is no any chat room for git

git send-email --smtp-debug=1 --to aman18591@gmail.com 0001-test-commit.patch
0001-test-commit.patch
(mbox) Adding cc: Aman Jaiswal <aman18591@gmail.com> from line 'From: Aman Jaiswal <aman18591@gmail.com>'
Net::SMTP>>> Net::SMTP(3.05)
Net::SMTP>>> Net::Cmd(3.05)
Net::SMTP>>> Exporter(5.72)
Net::SMTP>>> IO::Socket::IP(0.37)
Net::SMTP>>> IO::Socket(1.38)
 
DSM
That there's not a chat room for git problems doesn't make it on topic for a Python room, though.
 
rows = 5
columns = 5

gameboard_p1 = []
gameboard_p2 = []

def make_boards(*board):
    board.append([['0'] * columns for _ in range(rows)]) #AttributeError: 'tuple' object has no attribute 'append'

make_boards(gameboard_p1)
make_boards(gameboard_p2)

make_boards(gameboard_p1, gameboard_p2)
Can someone explain that error to me in plain english?
ELI5 please.
 
6:57 PM
> #AttributeError: 'tuple' object has no attribute 'append'
 
(which is also plain English)
 
>>> d = ()
>>> type(d)
<type 'tuple'>
>>> dir(d)
['__add__', '__class__', '__contains__', '__delattr__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__getslice__', '__gt__', '__hash__', '__init__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'count', 'index']
>>> e = []
>>> type(e)
<type 'list'>
>>> dir(e)
@Tokencodingnewbie ^^ the error is telling you exactly what is going on and the above shows you tuple vs list
read up on each data structure
and understand what differs between them and what you can do with each of them
 
board is a tuple but you're treating it like a list
 
I'll have to look up what a tuple is then.
 
definitely
 
6:59 PM
*board in def make_boards(*board): means "collect all the positional arguments and assign them to the tuple board".
 
the good news is that your code will be fixable with ~1 more line when you'll have done that
 
def foo(*bar):
    print(repr(bar))

foo([])

>> ([],)
 
DSM
Hint #1: add `print(type(board), repr(board))` inside your function. Is that what you expected? Why not?

Hint #2: why did you define the function using a `*`? What does that do? How can you get at the components if you do that?
 
So list and tuple are both data structures?
They both hold something?
 
notice bar is a tuple of a single list not just the list ?
 
@Tokencodingnewbie Respectfully, if you are asking whether tuple and list are data structures and what they store, I think you need to read up a bit
 
@Tokencodingnewbie If you're asking this question, you're not ready to use * in function signatures.
 
i do need to read up
 
then please do so
 
DSM
^^ it's not that it's hard, it's just that there's a lot to cover which will keep confusing you until you've got the basics down.
 
7:02 PM
I wasn't ready. I tried it out because I wanted to be able to make all the boards in one line
So okay read about tuples, and what else should I read up on?
 
Just go through the entire python tutorial. You can also find other resources on the site that hosts the room rules
 
Probably a tutorial, given the general level of questions you've been asking. It's fine to chat here, but we're not here to hold your hand while you learn the basics. sopython.com/wiki/What_tutorial_should_I_read%3F
 
^^yeah. We are very open to discussions about on and off-topic. But discussions that require us to "hold your hand" are really not fun.
and should not be an expectation here
 
Hand-holding will only occur if you take us to dinner and a movie first
 
7:08 PM
Just checked, and argument unpacking (the * thing) is covered reasonably early in the tutorial. You will need to read and understand (and prove to yourself that you understand) everything before it shows up, though.
 
@Kevin when are you free and where do you want to go/see ?
 
surprise him
 
And I mean all of us. Better call ahead and ask if they have bulk discounts.
 
We are willing to give group discounts if you try to acquire multiple room6ers
 
it'll be hard to arrange a time that works across all relevant time zones
 
7:12 PM
@AndrasDeak solution: attend PyCon :D
 
mmmm, pycon
 
recbg
 
:O:O:O:O:O
AVATAR PIC UPDATE
Is this the one that is going to last for the next 10 years? :P
 
wattttt
@Antti 10 more years and you'll go :|, then :( then >:(
 
7:27 PM
hey I was smiling in the pic
 
but less than the first
 
that ^
 
Andras' assessment so far is correct
And with that, please ensure you follow the pattern.
We are expecting less of a smile in 2027
^^ let it be marked and remembered
 
And in 2037, a frown.
 
2047, a pout ? what would be 2057 be ?
 
7:29 PM
A few scars, and a hardened frown
because we will be in the zombie apocalypse by then
powered by skynet
 
hahahahah
 
I SEEN THINGS
 
@WayneWerner that's after Antti's gold badge
 
7:30 PM
@davidism That's really nice :-)
 
@AndrasDeak after he works on a startup that gets bought out by Google, but he doesn't want google to buy the product he worked on. "Nope mine"
 
When I opened @github today... https://t.co/yp32EbDN4e
 
my face is so fat today that if I smile, it wouldn't fit into the square :(
 
There's always room for another gravatar in our ranks...
 
Join uttttthhhh
 
7:38 PM
Antti has ascended into his second form
 
wat github looks awful
 
I seriously don't know what changed
 
damnit I'll change my gravatar back :D
 
NO!!!
@AnttiHaapala Don't you effin' change it back
own that $%^&
own it!!!
 
7:40 PM
Do advanced developers use other utilities instead of sockets when they want to send something between two computers? I'm asking this because my socket is sending around 1kb/s and that's very, very slow.
 
Considering sockets are the only interface for network programming I'm familiar with, you'll need to elaborate.
 
No, you use sockets, at some level, if you want to communicate over a network. Sounds like your code is just inefficient.
 
Unless we're talking about high quantities of data, in which case writing to a hard drive and physically moving it to the computer might help.
Or your network is just really slow / unreliable
 
@KevinMGranger I used 127.0.0.1 and my own IP. It shouldn't be network problem I guess
So I should make my code more efficient instead of blaming the socket ?
I wouldn't know how to make it more efficient
 
8:01 PM
The first step is finding out where and why it's slow
 
Do you have an idea of how can I find out?
 
knowing is half the battle
 
I haven't done much python benchmarking aside from timeit, sorry. Your guess to start with is as good as mine.
 
profile
 
8:17 PM
@PichiWuana If you do something like for _ in range(100): socket.send(b'9000'*2048) and you time that and you're still getting 1kb/s being sent then the problem is probably in your network
but try alternate methods (e.g. FTP) to make sure
if FTP goes fast but Python goes slow then there's something sketchy going on
 
I'll try FTP
I'm trying to guess the speed
I printed os.fstat(file.fileno()).st_size for an opened file each time I wrote to the file.
Is that something wrong?
 
Why would that be wrong? What does that have to do with sockets? You're not doing a good job at describing your problem.
 
Sorry
I get info from a socket info = client.recv(1024)
I write it to the file, flush it and then print the size of the file
This above I do in a loop until I have the whole file I wanted to send to another computer.
 
Well, did you profile it? Was it taking a long time? Do your own work.
 
I know you're probably hoping to share something that is "obviously" slow and we can point it out, but it's never that easy. Plus this will be good practice anyway.
 
8:32 PM
@PichiWuana Actually, I just looked through your chat history, and you've been asking vague questions for almost a year. It appears you really haven't achieved a better grasp of Python or chat in that time. Please carefully read and understand skidmore.edu/~pdwyer/e/eoc/help_vampire.htm before continuing. This is your only warning.
 
Seems like the simplest diagnostic test to determine if the network is to blame is to recv the data and then do absolutely nothing with it. If your program is still super slow, then you know it has nothing to do with the writing of the file or the flushing of the file or the printing of the size of the file, because you deleted all that code.
 
cbg
 
cbg \o
 
@davidism I'm really sorry for that, it wasn't my intention. I will try to do my best to improve
 
8:53 PM
list.extend(iterable)
Extend the list by appending all the items from the iterable. Equivalent to a[len(a):] = iterable.
What exactly does that mean?
 
Did you try it and find out? What do you find unclear about the explanation?
 
fwiw the description looks very clear to me
 
The great thing about a language like python, is that you can have the interpreter open on the side and just try things right away and get immediate response
 
DSM
^ experimentation at the console is the best way to learn syntax basics.
 
100%
 
8:55 PM
Appending all the items from the iterable?
 
extra style points using ipython which includes a few nice features that make it a bit nicer to use
 
DSM
I'm still teaching my minion to experiment more with toy codes when something's puzzling.
%timeit alone is worth the price of admission (mostly to learn that you shouldn't care about timeit results, but still.)
 
@Tokencodingnewbie dude -> open console -> python -> hit enter -> experiment for much learning.
 
DSM
TFW you realize an old pandas bug is affecting one of your teams' results.. :-|
 
8:58 PM
TFW you google a random pandas problem and get a DSM answer, then turn to your colleague and mutter "This guy, this guy is good people." with no more explanation than that.
 
Fizzy out of the blue
 
hmm...The Usual Suspects, right?
guessing from the thumbnail and title
 
Fantastic film.
 
yup:)
 
8:59 PM
 
Why are you sharing butt-bread?
 
császárzsemle
next challenge?
I'm on fire
 
@Ffisegydd IT'S A KAISER ROLL!!! JESUS! GET THE JOKE FIZZY!!!!
uuuuuugh
 
oh you just reminded me of the Hungarian dude talking in the movie:D
 
9:01 PM
unavailable in my lowly country
 
DSM
Oh, hey, Fizzy! Hope things are well over there across the pond.
 
This is new to me and pretty cool but I just learned about raw.githubusercontent.com
using this to do some grabbing of docker compose files for some projects I'm trying to provision in my test stack
 
stackoverflow.com/q/42541492 opinion, at least given the way the op keeps commenting
 
9:18 PM
@DSM Things are okay, the pond is still there as far as I know. I trust that things are well in the Great White North.
 
Gmail to support up to 50 MB attachments http://ift.tt/2mGcehY (cmts http://ift.tt/2lsGw5J)
 
about yamming time
it's like we're living in the stone age
 
For some reason my Bayesian model just isn't fitting anymore D:
 
BAH
> Note: Sending size limits will remain the same at 25MB; however, just as before, you can use Google Drive to send larger attachments.
 
ugh....you know...I wish I read the whole thing before sharing while reading
because....that sucks
and misleading title
drive was always a solution
 
9:20 PM
I blame idjaw.
 
who the hell sends >25MB if gmail doesn't send >25MB?
 
Yup. Fair. I'll take this one.
 
That's lame, I was all excited for a second
 
2 mins ago, by Andras Deak
it's like we're living in the stone age
talk about first world problem though
@Ffisegydd switch to a frequentist model then! #ihavenoideawhatimdoing
 
Pipe down.
 
DSM
9:26 PM
Try maximizing the entropy. That always helps. ;-)
 
fizzy fizzy fizzy, can't you see, sometimes your words just hypnotize me. 🎵
 
that reminds me, I have a Brillouin function to derive
 
I think it's a dependency issue.
I upgraded numpy but I think pymc only supports an earlier version
 
isn't that weird?
numpy usually doesn't break any backwards-compatibility
 
And yet I was right.
 
9:29 PM
and did numpy break backwards-compatibility?
 
No idea, but now it works.
 
now = after downgrading numpy again?
 
Yes
 
you're weird
 
D:
 
9:31 PM
I'm glad it's working again:)
is it 1.11 vs 1.12?
 
Possibly
 
I forget
I closed the console
 
OK there are more than a few compatibility notes for that transition
 
Signing off.
it's been great being with you all today. It's been a while since I did that
rbrb all
 
9:35 PM
rhubarb
 
\o rbrb Joe
 
cbg
 
DSM
I just had a test failure because the test I wrote will only ever work in February. #unexpected
 
what ..... why ?
 
DSM
The test generates a time series which extends up to the current day. For simplicity I always toss the month of February because not every month has the same number of days. I wrote the code in Feb and today is the first day of March, so I didn't realize my mistake until it failed today..
 
9:47 PM
Now for an added challenge, make a test that fails based on the physical location of the computer!
 
it's better to code and fail than never coded at all, I'm glad you found your mistake
 
coming up: inexplicable test failure in 2020
 
welp time to head out. hope yall have a nice day \o rbrb
 
rbrb
 
10:35 PM
#flask Is it bad having 15 routes to a single endpoint?
They all lead to the same function (endpoint)
 
I wonder if anyone else got an email from the OP of this post
 
yikes
 
@JeromeJ you asked about this on the main site. Use query parameters.
 
@KevinMGranger While related, it's not the same question nah.
 
It might conjure images of crappy PHP code. But in this case, this is exactly what they're supposed to be sued for
 
10:47 PM
I found a solution but I just don't know if it's bad or not. Although it might not be practical, so it will be just a POC.
 
It's not the same question, but it's the same answer :)
 
So it's bad having 15 routes to a same endpoint? :) I know it's an XY problem but I'm still curious to get the answer to my Y question.
If it's fine, I got my overkill solution
 
Having 15 routes to the same thing is definitely smell at the very least.
 
15 is just the number of permutations for 3 options btw :P
 
And when you want to have a 4th, you'll have...
 
10:50 PM
Alternatively, as I have a pattern I could just parse it but I'm just reinventing the wheel of GET, oh well, thanks.
All for pretty URLs
 
Yeah, I agree that query parameters "feel" ugly, but they're a standard and well-understood.
 
Thank you for backing me up on that very subjective feeling :)
I'll get my question down, I thought it was legitimate but it has been put on hold so I guess not.
 
You asked for the "better way" to deal with your Y problem, but the "better way" was to solve the X problem. "better way" is a hint it might be opinion-based anyway, which makes it a poor fit for SO overall
 
It's not always easy realizing on what letter you are atm :D
That's pretty meta but I feel like someone... could come up with the same idea as me and it would save them a lot of time seeing this? dunno
I mean I wish someone did before me, it would have saved me a lot of time. :)
 
Definitely. Something something forest for the trees
 
11:16 PM
well, upvoted questions with answers on them won't get (auto)deleted even if they're closed
good night
 
00:00 - 17:0017:00 - 00:00

« first day (2328 days earlier)      last day (2637 days later) »