« first day (2349 days earlier)      last day (2599 days later) » 

DSM
2:01 PM
@Kevin: Python's various naming inconsistencies are a pet peeve. Make sure to be more sensible in KevinScript.
 
Conserving inconsistent names to preserve backwards compatibility is a problem I intend to solve by not having backwards compatibility.
 
DSM
That's not the kind of sensibility I had in mind.
 
My subjects will thank me for the opportunity to rewrite all of their programs with every breaking version change, because it lets them experience the joy of writing KS code once more
 
"Follow these rules, except sometimes you shouldn't". Forget style consistency, can we at least get guidelines that are free of paradoxes?
 
2:05 PM
I think .islower() was because "i slower" doesn't make any sense
 
What's a word for "creating an un-reconciliable divide between two parts"?
 
Hm. I would say 'divide asunder'
but that's not quite it
You could always ask over on ELU
 
Bear in mind that originally PEP-8 was intended for people writing Python code for the standard modules, but by the time it was published there were already the annoying inconsistencies that DSM mentioned.
Since then, it's been adopted as the de facto style guide for all Python code, but there's nothing wrong with ignoring the bits you don't like, if you're not writing code for the standard modules. :) Of course, it's sensible to adhere to the main naming conventions, uniform indentation, and not making your line lengths ridiculously long.
 
Natch
 
Yeah, I do whatever I feel like in my own code. I use PEP 8 primarily as an excuse to lecture others.
Luckily nobody reads the "use common sense when applying these rules" section while I'm stomping on them with it
3
 
2:16 PM
heh
But we all know that common sense isn't
@corvid oh hey - schism
that might be what you're looking for
 
DSM
I ignore E501 (the line length limit) regularly. I'm not going to uglify my code to match some arbitrary number.
 
long lines are ugly too :)
 
@DSM this, that limit is too weird
@excaza 80 characters is not enough
 
discuss with Brandin :P
 
DSM
Readability of a line is some crazy nonlinear function of its size, the number of logical tokens involved, and the number of syntactic bits you need to parse. Breaking opening and closing tokens into succeeding lines can make it harder, not easier to read. The rule exists for the sake of readability, not the other way around.
 
2:21 PM
@khajvah he didn't say 81 chars are ugly, he said long lines are ugly
 
I mostly stick to the line limit, especially for code I post in public, but I don't mind if a line goes up to 100. Beyond that, it's a bit annoying on this old monitor.
 
the only line width I care about is the one that begets a scroll bar on SO
 
In Raymond Hettinger's "Beyond PEP8" talk, he convinced me that +80 is ok
but he also explains that the reason you shouldn't flagrantly disregard it is because if you do have super long lines then it probably means your code is terribly nested when you could just break it out into a function.
 
What is the general take on questions like these
0
Q: Apt time between requests in python?

Anshuman TiwariUsing python request module(get function) I am scraping the links i.e. a crawler. I make multiple requests using the script. Since I was giving too many requests, Google intervened with CAPTCHA which was reset after sometime. I am using time module to put code to sleep for some time after each re...

 
@AndrasDeak yeah well, long is relative
 
2:26 PM
My non-PEP-8-compliant guilty pleasure is using extra whitespace to make common elements on successive lines line up nicely.
x = cell_width  * i + left_margin
y = cell_height * j +  top_margin

#rather than

x = cell_width * i + left_margin
y = cell_height * j + top_margin
 
Or rewrite it
 
@Kevin I find it wierd that you right-align the last terms
 
@Kevin I occasionally feel that way... until I have z = cell_with + cell_height * factor and now I have to screw everything up again
 
@AndrasDeak Maybe he's aligning the underscores
 
Well, that's an extreme example. The vast majority of the time, I only do left-aligning.
 
2:27 PM
@WayneWerner excellent, thank you
 
OK then
 
so instead of adding one line, I have to add and change 40
because dictionaries
 
:(
 
I might go as far as renaming the variables margin_left and margin_top
 
@WayneWerner a dictionary will tell you that it's cell_width, not cell_with *runs away*
 
DSM
2:29 PM
I've also been known to use whitespace to align equations, or do terrible things to variable names, like value_hi and value_lo, just to make it easier to preserve symmetry.
 
English is already a hot mess anyway so maybe it could do me a solid and make "height" and "width" the same length, perhaps by adding another silent g. I'm thinking "widthg"
 
@AshishNitinPatil I used to post "You do realise that you're breaking the Terms of Service, right?" comments, but I've (mostly) given up trying to fight that losing battle.
 
DSM
"heiht" I'd probably pronounce "hate", so the g's doing something. Which is kind of weird, to make it sound like "eight" you spell it differently, if you actually use "eight" I'd pronounce it "-ite"..
 
go home English, you're drunk
<Gerard Nolst Trenité: The Chaos>
 
Eghnglighsh
 
2:32 PM
ghoti etc.
 
tear and tier are pronounced the same, but tear and tear aren't.
3
 
also read and read
and lead and lead
 
(attribution: stolen from tumblr)
 
one of the great delights of my life is that username and password are the same lengths
 
Reminds me of a fantasy story I read where the protagonists were seeking the Macguffin, "God's Tear". They thought it was, like, a crystallized teardrop, but it ends up being a rift in the fabric of reality
 
2:36 PM
I think I mentioned it here in the past that it took me half a Game of Thrones book to realize that hearth is not h+earth but rather heart+h
 
also the abbreviations user and pass, but pass is taken in Python so there's that
 
DSM
@Kevin: always the spoilers, with you.
 
Pulp with such lame plot twists don't deserve the protections of the spoiler statute
Fun fact: there is no known origin of the "the butler did it" cliche. The phrase precedes any notable examples.
 
DSM
@AndrasDeak: to be honest, lots of people say her-th, esp. those who only read the words. I say it more like harr-th than hart-hh, though.
 
oh, no, it's harr-th alright, but I can't convey the pronounciation of "ea" otherwise
 
2:41 PM
Speaking of PEP-8...
Leading single underscores are to indicate private attributes, leading double underscores invoke name-mangling, which should only be used to prevent name collisions with subclasses,. Please see Method Names and Instance Variables and Designing for inheritance in PEP-0008. — PM 2Ring 36 secs ago
 
especially with guys around with weird southern western accents, eh?
Feb 24 '16 at 15:31, by DSM
So, question for the room: does "bag" rhyme with "vague"?
after things like that ^ I don't even try to transliterate pronounciation in innovative ways
 
Typically I pronounce it "har/th"
 
yeah that's what it should be
 
But I have also pronounced it "her/th"
 
with an IPA theta at the end
/hɑːθ/
 
2:46 PM
Heh. Theta. Actually "delta" is always amusing. I had a cal professor from China, and I couldn't understand what in the world he was saying. He pronounced it "btheda", like you were spitting or something
 
what's even funnier is when English-speakers try to pronounce Greek letters :P
 
that's the glyph he drew on the board
 
@AndrasDeak English speakers are pretty bad at pronouncing other languagees
 
That's a textbook quality btheda right there, what's the problem?
 
but bastardized Greek is official
just like bastardized Latin
*pronunciation x2
that gets me every time
 
2:56 PM
It took me Googling "greek alphabet" and the power of elimination to realize that he meant δ - the lower case delta
 
DSM
No day when I find myself writing Visual Basic before noon is going to end well.
 
> No day when I find myself writing Visual Basic before noon is going to end well.
FTFY
 
@AndrasDeak hearth? As in the fireplace?
I'll chime in that I pronounce it "har/th"
 
yes, thank you, I've known that since I read halfway through the first GRRM book
 
I am dealing with the joys of the Java classpath, if you're wondering where I've been.
cabbage all
 
DSM
3:10 PM
I'm writing VBA? davidism's writing Java? Today is a strange day.
 
@davidism There is no joy in the classpath, only sorrow and broken dreams
 
@AndrasDeak I was asking if that was what you were referring to, not telling you that's what it meant.
 
oh:D yes
sorry
 
If we want to add to the wierdness, I'm working with rails for the first time and kinda liking it
 
no worries...ambiguity of language is even worse than strange spelling and pronunciation ;-(
 
DSM
3:13 PM
@KevinMGranger: say hi to Wayne! (I think that's how it works, right?)
 
wim
I've a model with a char field and a date field
 
now you have me thinking where I first encountered the word "hearth" because it didn't trip me up in GOT.
hmmm...
 
wim
what's the query to get unique rows on the char field, by taking the most recent dated one should there be multiples?
like
"foo", 2017-03-22
"foo", 2016-03-22
"bar", 2017-03-03
if the table is like that ^ I want to select like this v
"foo", 2017-03-22
"bar", 2017-03-03
 
Oh it's a real question, I thought you were saying you had a date with a model with charisma
 
wim
3:16 PM
I was wondering why someone starred that
 
I'd link to what was linked to earlier, "What real life bad habits has programming given you?" but it's 10k> only
 
I may have to write VBA as well, but the real strange thing is that I actually get to do python work :P
 
DSM
My VBA experiment was successful, for what it's worth, so there's that.
 
is experimenting like that even legal?
 
@wim you need to use a subquery or cte
 
3:31 PM
\o david! I'm sorry I failed you.... I got distracted, 38 hours into the game and I just reach the Forest..... :\
 
I heard there were a lot of graphics problems with the PC release that are slowly getting fixed. At least you could play it.
 
I have zero issues to the game. :\ I ran it on max settings, and it was soo good...
 
I reached the last boss of Hollow Knight but lost interest in the whole "die half a dozen times before identifying the one safe pattern of dodging and attacking" thing, so I cheated myself some infinite life just so I could see the end.
I'm pretty sure I got the bad ending. The credits say I have a 95% completion rate so I guess the good ending is in the last 5%.
 
DSM
So it looks like I have a test which is passing because 2*inf == inf. :-|
 
Things I know I haven't done yet:
- extra-difficult rematch with the third-to-last boss (easy, if I cheat)
- extra-difficult endurance trial at the place with all the trials (easy, if I cheat)
- Complete the ---pokedex--- hunter's journal by killing at least five of every enemy in the game (infinite life will not help me here)
Pretend that strikethrough works on multiline messages, please
 
3:44 PM
I don't even see the markdown. All I see is strikethrough, underline, embolden...
 
wim
@davidism I thought there would be a better way than subquery, won't that be slow?
and I don't know what cte is
 
3:58 PM
Subqueries aren't slow unless you're doing crazy things in them. You'll be fine with this.
Honestly, you'd probably save more time by querying them all then doing the filtering in Python rather than figuring out the query.
 
wim
yeah, ok, I was going to try that first anyway
unbelievable
> Python shot to the most wanted language this year (as in, the language developers want to use this year more than any other), after ranking fourth last year.
ooh
 
DSM
This may explain the increased attention I get out on the town.
 
"python 3 is killing the language"
 
wim
Notepad++ more popular than vim ?
ok I'm seriously starting to find some of these results dubious
there is NO WAY notepad++ is more popular than vim with professional developers
 
on that SO developer survey, looks like python is the "most wanted" language
 
4:21 PM
@wim Maybe all the vim users have their own secret alternative to SO
 
@Kevin ssh
 
The SO demographic doesn't line up perfectly with the "professional developer" demographic because the majority of the latter doesn't really have time to do other people's A-level programming assignments for them
 
DSM
I never use vim (:q! excepted) and sometimes use notepad++..
 
wim
what do you use when you're ssh'ed to some remote machine?
 
DSM
4:26 PM
I refuse to answer on the ground it may tend to incriminate me.
 
I use Notepad++ because I'm a luddite and don't want to learn a new IDE every time I switch languages
 
Is it nano? You can turn in your hacker card at the front desk.
You know, in plan9, you'd just network-mount the remote filesystem and it wouldn't matter what editor you use ¬_¬
 
4:51 PM
@wim Sorry, dude. Feel free to post again but with the NSFW warning.
 
I have to keep typing the word "shot" in my code, but my mind autocompletes it to something else...
 
burger shot
@DSM Not for me. It does for you? Really?
 
why would you pronounce it as "vag"?;)
 
oh my goodness.....I clicked the quote and not the "time stamp"
 
5:02 PM
(I really hope that I'm joking and it really is "bag" that's off)
 
haha
oh you!
 
I was going to comment on the 1+-year-late reply:D
 
I give up
 
But you've only made it halfway through the week!
 
^^ It's in French, but I think it is still easy to get the joke
 
5:06 PM
:D
 
You're gonna get it Martine...You're gonna get it. Just keep at it.
 
user2603796
Hello everyone
 
user2603796
I had quick question about binascii.unhexlify
 
Don't forget to leviosa bro
 
5:10 PM
@FarazAhmad shoot
someone (not me) might be able to help
 
user2603796
I am trying to convert a string representation of mac address into \xAB\xCD... form
but when I do the call binascii.b2a_hex('F1:24:ff:ff:ff:ff'.replace(':','')), that 24 part is converted to $
 
user2603796
instead of \24
 
user2603796
:/
 
it might not matter, but: python 2 or 3?
 
But the dollar sign is exactly what "\x24" is. You only see "\x.." printed if there isn't another better representation of that character. But "$" has a better representation: "$"
>>> print("\x24")
$
 
user2603796
5:15 PM
the thing is I want to use this byte sequence in a further call to len(my_byte) function, and here it is raising error i.e. TyperError non-hexadecimal digit found :/
 
But if you absolutely must get a slash followed by an x followed by two hex digits displayed, you can always render them yourself manually.
>>> s = 'F1:24:ff:ff:ff:ff'
>>> print("".join("\\x" + pair.upper() for pair in s.split(":")))
\xF1\x24\xFF\xFF\xFF\xFF
ofc it's going to count the slash and the x and the two digits as four characters for the purpose of len
@FarazAhmad Well if you're just doing it to find the len, then it doesn't really matter what it displays as. "$" and "\x24" both have a len of one.
 
DSM
@idjaw: yep. It's a Prairie thing, you Easterners wouldn't understand.
 
@DSM interesting. Something new I learned about The Data Science Man's origin story
cool
 
user2603796
I want the number of bytes in length, i.e. len('\xFF') is 1
 
Ok, and you can still do that regardless of what print("\xFF") displays
>>> len("\xFF$\xFF")
3
>>> len("\xFF\x24\xFF")
3
 
5:22 PM
This is actually a surprising result for me. Anyone else find it surprising? stackoverflow.com/insights/survey/2017/…
 
DSM
Depends. Are you surprised that Windows is so low or that it's so high?
 
Windows is so high
 
user2603796
Thanks @Kevin
 
if you look at the front page you'll see that SO users have hardly more good sense than the general public ;)
 
5:24 PM
@idjaw Visual studio.
 
I'm not sure what that "Platforms" stat even is. It can't be what people are using to develop on, because who would use / how would they use AWS?
Android could be ChromeOS.
 
DSM
Actually, that's interesting. What OS do people develop for Android on? Never thought about it before.
 
are the survey questions archived someplace?
that might help
of course this is all a distilled version of the survey data dump, run through a data person working for SO
 
I did a little Android project for work about three years ago. We used Windows & Eclipse.
 
surprises might simply be due to human errors
 
5:28 PM
@DSM I've done it on Windows surprisingly, using Android Dev Studio for Windows
 
the silly little app I wrote for myself worked great with linux & android studio intellij
 
DSM
Huh.
 
I feel vaguely guilty for not doing more android stuff. In principle, I spend more time in proximity to my phone than with all other computers combined, so if I was going to write programs for personal consumption, it should be on that platform.
 
wim
how lame, you can't sum(...) a list of timedeltas without specifying a custom 0
 
But writing even simple applications is a pain because of how slow Eclipse is on my machine
 
wim
5:33 PM
why it adds them all to 0 ??? instead of just adding them all
 
@wim I never liked that behavior of sum. It should use the first item as a base if you don't provide one.
That's what reduce does.
 
wim
exactly
 
sum([]) can still return 0 though, that's fine
 
wim
sum([]) is 0 by definition , and documented ("When the sequence is empty, returns start.")
 
Looking at that survey, I wonder - you guys in the US really get paid a huge lot..
 
wim
5:37 PM
but I can not think any good reason for the default value of start to be added on otherwise, that violates principle of least surprise
 
Same as in swiss, but in swiss it's just that living expensive are equally high. - Is all technical personel so much overpaid in the US?
 
have you considered that we are underpaid?
and by "we" I mean "you"
 
wim
how much do you get paid?
i think a lot of dev salaries come from place like SF which probably has higher cost of living than even switzerland
(san francisco)
 
Perhaps it's a not-too-subtle indication that the language devs don't want you passing non-numeric types to sum. Same reason that sum(["a", "b", "c"], "") fails even though it could easily work
 
wim
and NYC is really exy too
 
5:39 PM
Well not compared to everyone around me - it's common to get just above 25,000 euro for just finished with study mechanical engineers with a doctorate here. - growing to 50.000 in your 60s
 
"If you can't add X to 0, don't pass [X] to sum", they hypothetically assert
 
I am definitely below average, coming from an area with ~20k people
 
It was 80 degrees out last week. Now it's cold and raining again. San Diego!
 
But just look at the graphs: stackoverflow.com/insights/survey/2017/…
 
wim
@paul23 wow, it's so low
 
5:42 PM
My salary is below average but I receive fringe benefits, such as an above-average tolerance by management for me spending all day in a chat room
 
XD
 
Don't forget all federal holidays :P
 
I don't know if I've ever disclosed the fact that I get all federal holidays off... Your Internet detective skills are pretty good.
 
wim
25,000 eur you would make more than that money flipping burgers in mcdonalds, no joke
 
> using 1 space for indentation
this is almost impossible to read, I have no idea why people do this
 
5:43 PM
@Kevin it's because I'm bitter that I don't get them off :)
 
we should take into account the additional utility of not being shot any moment in the street
 
I work in Philly. I only avoid not being shot in the street by not being in the street.
 
wim
@Kevin hmm, not convinced ... "".join(...) is better for strings, but there's no better way to sum timedeltas that i'm aware of
 
Fringe benefit 2: office has thick external walls.
 
5:44 PM
Philipines?
 
I was talking about the European cheapo situation
 
THought you were from the US Kevin?
 
@paul23 -delphia, I think
 
Philadelphia, yeah
 
it's close to Manehattan
 
DSM
5:45 PM
When my mother worries about me I try to explain that it's more likely I'll be the perpetrator of violence than the victim, in "I'm the one who knocks" style.
 
It's within one New Jersey of Manhattan, yes.
Let's say 5/6ths of a New Jersey since you can skip the southernmost bit
 
only lose faith in the 42%
 
I choose to believe that everyone that uses the tab key to auto-insert four spaces put down "tabs" for that question
 
@AndrasDeak +19% - both is even worse.
 
5:51 PM
maybe a lot of those people aren't even aware of what their IDE actually uses
 
I choose to believe that everyone that uses the tab key to auto-insert four spaces also put down "both"
Would you look at that, now it's 100% spaces
 
DSM
One admires your optimism.
 
except people who use tabs to put tabs in vim
you'll have to start knocking on doors ("Sarah Connor?") to make it 100%
 

« first day (2349 days earlier)      last day (2599 days later) »