« first day (2810 days earlier)      last day (2363 days later) » 
01:00 - 18:0018:00 - 00:00

18:00
@Kevin my snarky submission as a response to your non-snarky one [].append(0)
-2 bytes: {0}.add(0)
[].sort()
@MoxieBall now you just made me feel like I didn't think my joke thru.
It was great inspiration, though
couldn't have done it without you
BOOM! MIC DROP
print()
18:05
>>> int.__text_signature__
>>>
or print();
exec('')
help()
quit() may or may not return None, but we'll never know
@AndrasDeak I was just about to post that :/
18:09
whoah, I had no idea that reserved keywords can't be attribute names
f'{help()} pizza left beef'
speaking of old memes
Also TIL:
>>> True.conjugate()
1
well it's sort of an int...
wim
wim
int subclass thing
annoying
But wait, the docstring:
conjugate(...)
    Returns self, the complex conjugate of any int.
Kinda misleading
wim
wim
18:12
why?
'cause 1 isn't True's self
wim
wim
but the mro
oh, right, I see what you're saying
>>> 'None' in vars(builtins)
True
>>> builtins.None
  File "<stdin>", line 1
    builtins.None
                ^
SyntaxError: invalid syntax
wim
wim
huh
that weird
>>> getattr(builtins,'None') is None
True
wim
wim
18:14
oh, it's a keyword
wim
wim
not so weird
softened version of
5 mins ago, by Andras Deak
whoah, I had no idea that reserved keywords can't be attribute names
Reminds me of how 1.conjugate() is a syntax error
@Kevin but that I understand...
>>> (1).conjugate()
1
>>> (builtins).None
  File "<stdin>", line 1
    (builtins).None
                  ^
SyntaxError: invalid syntax
18:16
>>> 1..conjugate()
1.0
>>> .1.conjugate()
0.1
wim
wim
>>> True.imag
0
>>> True.real
1
funny that these are ints when they would be floats for a complex
@Kevin The lexer just goes forward, it can't back up. So once it's seen "1." it's already lexed it as a float, it can't back up when it sees the "conjugate" and say, "oh, that '1' must've really been an int".
Not the shortest submission to produce None, but my favorite yet:
>>> ....__doc__
>>>
Noice
Seems like a double standard that the lexer can't back up for conjugate, but it can back up when it sees a period and says "oh, I guess that 1 must've really been a float"
wim
wim
18:24
it never backs up
it's greedy
will take the biggest token it can (ref)
new candidate
oh, deak already got it
@Kevin What the badger said. That's why (1).real and 1..real work, but 1.real doesn't
18:57
cabbage
19:12
cbg
cbg
Anyone have any idea how one would begin to think about parsing custom excel number formats in python? exceltactics.com/definitive-guide-custom-number-formats-excel
Convert numbers to the proper format with the style applied. I was thinking some sort of PEG
Converting numbers to strings doesn't sound too hard. Converting strings to numbers sounds hard. I'm not sure which one you're trying to do.
@Kevin I want to take #,##0.00_);(#,##0.00) and apply it to 245060403 and it becomes $245,060,403.00
The first part is an excel custom number format.
19:27
Oh, so parsing excel format strings, not parsing the contents of cells that have been formatted according to an excel format string
@Kevin right parsing the string to apply it to a raw string to format it.
I thought you wanted to parse "$245,060,403.00" and get #,##0.00_);(#,##0.00) and/or 245060403
Oh... No way. That's insane
I think ;)
DSM
DSM
Do you need to do it yourself or can you use off-the-shelf tech?
If I can find anything off the shelf I'd use it
But I haven't been able to find anything
19:29
I wonder if there's anything in the .net libs for this...
It does have to be open source because it's going into open source software.
I did find one project yesterday that was written in c# I start to convert it line by line to python but I stopped because I think there's got to be a better way
github.com/andersnm/ExcelNumberFormat (I don't know if it works or not)
19:45
angry crab on okeanos
mostly a lot of eels today
DSM
DSM
@Johnston: hmm. I actually can't find what I expected in Python.
@DSM. I was looking at the xlrd and others but I don't think those libraries have to ever actually parse it. They just have to insert the code into the XML and excel does the parsing.
tired cbg
   │─│ ─g
│b─c─┌┐g─
│┘──│ gb
──g│── ─
    ─ └ ─
DSM
DSM
20:21
@Johnston: yeah. There are a few JS libraries which do the formatting natively, but to my astonishment I can't find anything in Python which does what I want. My google-fu has failed me. :-(
@DSM where do you see JS libs
I could use a JS lib....
hey can somebody help me out?
<<< big pythin n00b here
DSM
DSM
@Johnston: see here, and demo here, which seems to work on your example.
@DSM Your google-fu skills are greater than mine
@Anthony no need to ask to ask, what's up?
20:26
give me one second just talkking to somebody
me too
hi, is this a place where I could ask a question? I posted a thread but the only person who responded couldn't figure it out
yes, and please read the room rules
ok, read them. i'm trying to use scrapy to gather the school name from this site: athletic.net/TrackAndField/Athlete.aspx?AID=7844096#!/L4. I tried using inspect element to copy the XPath, but response.xpath('//*[@id="anetMain"]/div[3]/team-nav/div/div/team-nav-logo/div/di‌​v/h1/a/text()') returns an empty array for me. am I missing something?
sorry I missed the backticks: '//*[@id="anetMain"]/div[3]/team-nav/div/div/team-nav-logo/div/div/h1/a/text()'‌​
i got it figured out
thanks anyways @MoxieBall
how do i access this chat room from the main stackoverflow.com website for future ref?
20:40
Go to the all chats page and star this one. Will make it easier in the future.
@MoxieBall thanks! how do i access the all chats room from the main page tho?
chat.stackoverflow.com?
I officially just answered my first numpy question
I guess I have to learn numpy now
20:43
I've been avoiding numpy and pandas for a while but they both seem like things that would be useful to know
My take is that once you are familiar with Python, they definitely look like great tools, but I think a lot of people get their skills hurt by the fact they learned numpy "before" Python
Same with pandas
what is numpy? a framework (to do what)?
@roganjosh you can type [edit] into a comment and SO will generate a link to edit the post.
I have just never run into a situation where I thought "wow, the builtin types are not enough for this, I need pandas"
Me neither
I think NumPy is overall faster though, no?
20:46
And so many times I see questions on here where I think "why did you do this with pandas?"
7
Mostly because I don't know what either of them are really good for, and I can think of how to solve the problem without them
I agree with that so much
DSM
DSM
@kreesh: sorry, what are you trying to extract? "Monta Vista HS"? "Monta Vista"?
@OlivierMelançon Was that an actual question or a passing statement?
@Simon A question about probability distributions that did not need numpy
I see; yep Numpy is not nessesary here.
DSM
DSM
20:55
Package has arrived! Time to go pick it up. Rhubarb for all!
Rbrb @DSM
rbrb
Not at all, both are already in the random module
I believe that libraries are good to solve problems that occur very often, when it comes to manipulating data. :)
Else than that, let's say the "abstracting" part of your code, the one you usually comment, should be made of pure python most of the time. And knowing Python in depth is really different than knowing a library.
But some people know NumPy, but not Python :/
+1
20:58
often** and complex. I forgot. Because manipulating Machine Learning for instance requires the use of these libraries to be really effective most of the time. And you don't do Machine Learning every day. ;)
I've seen people trying to use Tensorflow before knowing what a string is.
Correct, I am critical of some people going to NumPy too fast. Although, I'm usually being more gentle with people going to libraries like Keras very quickly
Because, you do have a very specific problem there
@Simon Probably painful to see
Numpy is faster only up to a certain point. For small tasks it's faster to use builtins
Very.
I feel like using keras without understanding python is a bit different than using numpy without understanding python
I'd even try to argue that doing a year of low-level language at a high rate would be a good way to start programming. So that when it comes to Python, you won't have to redo all these boring tasks that our computer can do by themselves with our nowadays computers. But you will still be able to understand what's going on under the hood. :)
21:05
Yes, I had the chance to be taught C before Python, and I'm sure my Python skills have profited from that
Yeah, you are doomed to fail, with Numpy you might hack something together. :p @MoxieBall (I might be wrong, but I've seen loads of "simple" problems in Keras that turns out to be more complex)
I learned R5RS Scheme as my first language, so any time there's a question on here missing a parenthesis I've got hawk-eyes for it
If all you know is Keras though, you might endup training a neural network to solve that fizz buzz problem...
I'm glad everyone here agrees. :D
to be fair, I think a big reason people are flocking to learn keras before learning anything else is because people (including the library itself) heralds itself as "so easy you can do it with your eyes closed!", and so why be surprised when people come w/ their eyes closed?
21:10
fizz buzz code golf is probably the most overdone thing ever, nevermind
I never saw a code golf of it though
Did not look much either, but I want to give a shot
I think I did 6 interviews recently, and I didn't see Fizz Buzz once.
This is no longer used in interviews
Because it's now part of all interview prep guides
ooh, anyone want to hear my favorite interview question I've ever tangentially heard of?
21:14
I've seen the "Hendragon Problem" though. It consists of replacing string over time / estimating the final string of a given time / moving on a 2D plan, using a pointer, taking orders of given string.
Person A and person B are performing a card trick for person C. Person C picks 5 cards from a normal deck of normally-shuffled cards, and gives them to person A. Person A looks at them for a while, rearranges them, keeps one, and gives 4 to person B. Person B then tells person A what card they are holding.
How?
My favorite puzzle is the ant one: "One hundred ants are dropped on a meter stick. Each ant is traveling either to the left or the right with constant speed 1 meter per minute. When two ants meet, they bounce off each other and reverse direction. When an ant reaches an end of the stick, it falls off. Of all starting configurations, what is the longest it can take for the ants to all leave the stick?"
@MoxieBall Ooh, I love that one. There must be a way to pass some information with the order of cards, I want to figure out how
I'll be around for hints at request, let me know.
Define normally-shuffled cards.
as in, how the cards are shuffled is not the interesting part of this problem
21:19
Does Person C picks the cards linearly ?
Doesn't matter
@DSM sorry for the late response - I'm trying to extract the "Monta Vista" near the top of the page.
I think I got it, or close. There is no way to give a code with kind and figure, so it must be that you use the ordering of the given cards to give a code. You have 24 possibilities, which is not enough to give the exact card, but you can also add some information by picking a card that is in the smallest interval of cards you have given to B
I don't have the code, but there is enough information passed to guess the card
So it exists
The ant one is a lot easier to guess than prove
And yeah, the fun part of the card problem is knowing that there's a way to convey all the necessary information and not knowing what it is
Do we have to imagine things ? Or do we have all the element to have a single answer in your question ?
21:22
You'll see when you prove it :p
I suppose the answer to that question is that person A and person B know the same things, and you have to tell me what they know that makes this work.
The ant one is something I often give to highschool students to show them that from the correct angle, a lot of seemingly complex problems are trivial
But it's not a "ha, you didn't think of that! gotcha!" question, there is a way to do it.
@OlivierMelançon A similar problem is the airplane boarding problem, where there are n people getting on a plane, and the first person sits in a random seat, then everyone else who gets on sits in their seat if it isn't taken, and a random one if it is -- what's the probability that the last person who gets on sits in the right seat?
I guess it's 1/n
provided n is also the number of seats
The real answer is here
and yeah, that's assuming there are n people and n seats
21:43
Oh I got the card one. You have 5 cards, at least two must be of the same kind, call them c1 and c2. So the first card will be one of those, giving away the kind. Then if c1 and c2 have the same parity give the highest of both. If they don't give the lowest. From that B knows the kind and has only 6 choices (same parity higher or different parity lower) of figure. It turns out you have 3 remaining cards, from which you can build a code from ordering since 3! = 6
Is that it?
the only issue with that is that your partner won't know if they have the same parity, so they won't know if they got the lower or higher card (I think?)
I am sure there are other ways, but that one seems to work
They don't but they know that if the card is lower it is of different parity and if it is lower it is same parity
Example, you are given 7, you know your choices are 2, 4, 6, 9, 11, 13
You are given 8, you know your choices are: 1, 3, 5, 7, 10, 12
Your choices are {higher cards with same parity} + {lower cards with different parity}
I am sufficiently convinced -- however, the easier way is just to agree to always count up
you have a 3 and a 7, you give them the 3 and count up 4
you have an A and a 3, give them the ace and count up 2
etc.
What if you have 1 and 13?
13 -> 1
count up 1
21:50
Oh!
I get it, that works too
and then there are 6 permutations of the last 3 cards, so you and your partner just have to agree on the same permutation order
The fact there exist one method is proof that there is sufficient information. Thus, there are probably many many codes you can make up
But yours is a bit easier, so if I were to do it with a friend, I would go for that one
It's the first time I've ever heard an answer that uses the parity of the two cards, too clever for me
I thought of it when I figured that the 3 last cards offered 6 permutations and B had 12 choices. Parity is what can divide that by 2
I did too much algebra where you always end up figuring that taking something modulo some prime yields an interesting property
rbrb and well-puzzled
21:57
rbrb
That was enjoyable
22:43
cabbage
22:55
cbg
I've seen a number of numba questions related to numpy today. Does anyone have experience in this speeding up their code in real application, specifically using numpy?
Yea I use jit all the time
jit on numpy code?
Yea, numba handles numpy arrays
I know from the docs that it can work, but does it give you real speed results that you have tested?
Oh yea, pretty hefty speedups. One of the nicer things about numba is the Automatic parallelization, I just wish that the feature worked on GPUs
Currently CPU only
23:02
mmm, maybe I'll pay more attention to it then
I can see it in the case of regular python but for numpy, I had assumed that the overhead of actually jitting the function would just trash the original performance. Presumably you use on something called in a loop?
got +4 User was removed - happy times.
23:22
There was some user who would down vote me like 10 times a day, and it would always get corrected, hopefully he got removed too
23:56
@AnttiHaapala Nice. I assume that's a user from ~6 years ago. Funny how older members "outlive" many other users (even though they may have signed up at the same time).
01:00 - 18:0018:00 - 00:00

« first day (2810 days earlier)      last day (2363 days later) »