« first day (1818 days earlier)      last day (3146 days later) » 

2:00 PM
@samayo Are you actually handling every possible error?
 
I like this approach to reduce btw. Python 3 took it out for being too hard to read, KS is making it harder to read.
 
Anonymous
@khajvah Nope. I just have my script that fetchs JSON data, and submits to database. It is simple, but for whatever error that occurs, I was hoping it would be ok to just do one try/catch for the entire thing.
 
user559633
@QuestionC Wait, really? It got moved to functools because it was hard to read? I thought it was a "at one point, people that liked FP were hacking on Python and we didn't want to lose their dev time, but now we're everyone's favorite beginner language, so out it goes"
 
> So now reduce(). This is actually the one I've always hated most, because, apart from a few examples involving + or *, almost every time I see a reduce() call with a non-trivial function argument, I need to grab pen and paper to diagram what's actually being fed into that function before I understand what the reduce() is supposed to do.
 
I'm generally not into functional programing, but despite what Guido said in that quote I must admit I have a soft spot for reduce, and was a little sad that it's been moved to functools. OTOH, I also ought to admit that I wrote a few implementations of accumulate in Python 2.4, before generators existed. :)
 
2:05 PM
I only struggle with reduce because I can't remember the order of the arguments passed to the callable. I would like the hypothetical syntax to eliminate that ambiguity.
 
user559633
My ear is bleeding from somewhere deep inside. Should I be concerned or is this weakness leaving the body?
 
cabbage all
 
user559633
cbg
 
Ex. it's evident what s and c refer to in <s.replace(c, "") for c in seq with s starting as my_string>
 
I'm having a total fanboy moment right now: Armin Ronacher just emailed me about discussing the Flask 1.0 release.
9
 
2:06 PM
Well, evident to me at least.
@tristan I suggest medical attention.
 
user559633
@davidism Oh? Can you share details?
 
I think the issue with reduce isn't so much that it's bad but "Is this as a function any better than using 3 lines?"
 
Wait, that syntax doesn't work because I didn't give it an iterable.
 
Well, not really, because those are the only details. :-) It was related to this post I made: github.com/mitsuhiko/flask/issues/1575#issuecomment-145716465
 
Well my point still stands, albeit wobbly
 
2:08 PM
I guess I would like to see an example of reduce being passed as an argument to some functional voodoo.
 
Anonymous
@davidism All this time hearing good things about flask, I didn't even know it was still on pre alpha
 
@Kevin I was thinking something like sum(x) == add(***x)
 
user559633
Well said @davidism.
 
@samayo That might be ok. Generally you should try to minimize the amount of code in the try block. And you should catch each possible exception individually. Python exceptions are very efficient, and they're faster than the equivalent if: ... else:... code if the exception doesn't get raised. But they're much slower if it does get raised. So if you expect that 95% of the time the exception won't get raised then definitely use exceptions. Otherwise, use if: ... else:....
 
user559633
Is the argument from other people in that thread "I want a bunch of frequent releases because I'm using some tool that's not specific to Flask and I don't want to spend the 10 minutes to version stuff on my own?"
 
2:12 PM
f(***x) would be reduce(f, x) if that's not clear..
 
@samayo it's not on pre-alpha, it's stable and has been used in production for years
the version scheme is just not the normal one
 
user559633
And ugh, I hate github PR philosophers "We are conditioned to believed software needs constant updates... Perhaps it's because of the strong gatekeeper keeping everyone off the update treadmill that attracts so many people to this project."
 
It's a little tricky to write syntax that fits all cases, because reduce has an optional third argument
 
user559633
shut the yam up holy hell you are not a philosopher you just have an internet connection
 
@tristan my least favorite thing about github issues is the "+1" comments with no other content
 
user559633
2:14 PM
@davidism i prefer +1 to "i got lost on my way to tumblr to bitch about perceived, imagined inequality, so i guess i'll dump my purse out in an open source project issue tracker"
 
f(***(init + x))? =)
It is tricky, yea.
 
Sounds like github is another in a long line of communities where noise drowns out signal as it accumulates users
 
There was a good thread on Django's tracker about "you should change the database settings from "master/slave" to "primary/secondary"", and they actually caved in.
 
user559633
@Kevin it really is. it's hard too because there's not a great way to gatekeep
 
github, meet usenet, slashdot, reddit, stack overflow...
 
user559633
2:16 PM
@davidism yeah, i saw that. fucking stupid.
 
user559633
follower/dear leader or something
 
@davidism Wow, source?
 
user559633
code.djangoproject.com/ticket/22667 here's the faster version
 
user559633
SJWs will ruin everything good about the internet with their demands for censorship.
 
2:20 PM
Trigger warning next time please. I have PTSD from the previous times SJWs ruined everything good.
 
Didn't the whole Django thing happen for other reasons than the SJWness?
 
Anonymous
@PM2Ring thanks. Just completed codeacadamy tutorial, and this is my first python code, which is why I want to know if I am abusing something in that code.
 
Don't get me wrong, they certainly jumped on the bandwagon
But master/slave was an inaccurate term, because there could be multiple master and slave relationships, which meant they weren't all that accurate in the first place?
 
user559633
@IntrepidBrit because someone core to it, that i no longer respect, thought he'd get internet points and wanted to pretend he's making the world a better place, fastlined it into being accepted
 
user559633
@IntrepidBrit master/slave is closer to leader/follower
 
user559633
2:22 PM
• a person who is excessively dependent upon or controlled by something: the poorest people of the world are slaves to the banks | she was no slave to fashion.; • a device, or part of one, directly controlled by another: [ as modifier ] : a slave cassette deck. Compare with master1.
 
Aye, but the implication of master in development is that of a supreme authority, a singularity controller. So in a bus network, the master might initiate any and all communications to the slaves on the rest of the bus
 
user559633
anyway, it's way easier to complain about word choice in relatively minor places on the internet than to go, you know, actually help people
 
Agreed. looks at FB feed
 
user559633
yeah, i've never heard masters plural. oh wait. i have.
 
user559633
PSYCHEEEE skateboards away
 
user559633
2:25 PM
 
Ah the old political horseshoe :P
If we're talking historically and purely linguistics, then there were obviously more than one slave master - but taken from a development perspective that's generally not been how the word master has been perceived
 
user559633
prove it. i started working in tech in the early two thousands and had heard of multi-master ldap and database servers (here's proof of the latter downloads.mysql.com/docs/refman-4.1-en.a4.pdf -- 2000/2004)
 
what's in the bottom middle of that diagram?
 
Monsters
 
user559633
@davidism tumblr, homeless people that shout jibberish, people that think if you use the word master in a codebase, you're a cis white male racist transphobe privileged patriarchybot
 
2:31 PM
I was expecting the answer "Ruby and Java programmers" :-P
 
user559633
I find Ruby devs are typically far left crazies and C# are far right crazies
 
user559633
Except the far right are more productive and the far left in the dev community only wants to be histrionic and talk about "culture"
 
@tristan That's just income difference. =)
 
@tristan I've just looked up various IT sources and definitions on the internet, and not a single damned one mentions multiple masters. Where in your link does it mention multiple masters? Not particularly inclined to peruse over 1.5k references to the word master
 
user559633
@IntrepidBrit Search multi-master
 
user559633
2:34 PM
Also, it's not on me to prove :)
 
@IntrepidBrit Well... the place I know Master/Slave from (old hard drives) certainly had multiple masters.
 
I don't really know what it means in the context of Databases though.
 
user559633
In databases, it's when you have a multiple set of database masters that can control the same pool of slaves
 
@tristan (searched multi-master, 0 occurrences in that link)
 
user559633
2:39 PM
@IntrepidBrit Well, 1) it's on you to qualify 'taken from a development perspective that's generally not been how the word master has been perceived' 2) '12.5.1 SQL Statements for Controlling Master Servers'
 
Why not change it to primary/secondary though? They seem like more relevant terms.
 
Would you guys say "Advanced Python" is an Oxymoron?
 
Good mix: mixcloud.com/elneco/stellar-origins (nsfw cover picture)
 
user559633
@MorganThrapp Because it's not. The slaves listen to the masters and carry out their commands. Primary/secondary has other connotations like "is a back up" or "is a second tier" and does not describe the relationship given a database.
 
No, but I'm sure some C programmers would condescendingly.
 
user559633
2:42 PM
Also, how is changing it to a less specific, less industry recognized term bettering technology, society, or enhancing understanding?
 
Primary/Secondary doesn't really imply anything other than the fact that some kind of tiering.
I could see something like Controller/Harblfarbl.
 
Ultimately, I don't feel strongly about the wording before or after the change, but just the fact that it happened at all is what's weird to me.
 
"Wood, condescendingly" is the name of my local access do-it-yourself carpentry show. Watchers will learn to build a bird house, but only if they can tolerate my patronizing tone.
 
user559633
forget it. i don't care. you're right, changing it to a more confusing set of less descriptive terms has retroactively removed slavery from all societies. you dun it! go to this link to collect your tumblr trophy
 
@tristan 1) Not forgotten this, just pondering what you've accept as an authoritative source. 2) All I see there is that it's possible to have multiple masters and that the administrator can do things to them. No mention of them sharing each others slaves
 
Anonymous
2:44 PM
What is wrong with calling it slave/master? It is just a technical word. It is not a reference to people or any person
 
@PM2Ring turns out - I think the problem with repr may actually be an artefact of the bug I'm trying to catch... the repr works fine when the bug isn't present. Curiouser and curiouser
 
@JRichardSnape Tricky!
 
user559633
@IntrepidBrit Then address 1. 2 this is one document that mentions multi master. the point of multi master in a replication group is to share the duties of slaves
 
DSM
454-chat-messages-to-read cabbage for all.
 
user559633
@samayo imagine that you don't have much going on in your life and want to be an activist for the attention. do the hard work of working inside a complex political system, gaining power, and affecting change? GROSS, HARD WORK. find the word 'slave' used to describe a relationship between two software processes and bitch about it? AW SWEET THAT ATTENTION IS DELICIOUS
 
2:47 PM
@MorganThrapp I'd have to agree with the other guys on this one. For the sake of clarity, I'd find master/slave more intuitive than primary/secondary.
 
user559633
trigger warning: treating people like adults
 
Anonymous
@tristan exactly.
 
I dunno, I mean, I'll admit I don't spend a ton of time working with database replication, but both terms seem equally clear to me. I honestly don't care which terminology is used. I just don't get why ER MEH GOD CHANGE IS BAD AND EVIL.
 
OK, discussion over. We don't want to become the thread we were making fun of.
 
2:50 PM
hums the Charles in Charge theme song
 
DSM
@davidism: I noticed you reached 135 on that comment! You may reach 150 or so before it's over.
 
stops working on his joke about COBOL programming being slavery
 
user559633
@AaronHall whoa the lyrics "charles in charge ... of our days..and our rights. charles in charge of our wrongs and our rights" is charles a demigod?
 
Ghostbusters teaches us that Charles should reply "yes" to that question.
 
DSM
He clearly has power to bind and to loose ethical matters. He's got to be pretty far up there.
 
2:52 PM
That was a pretty big conference call, I wonder if they know that was me...
 
user559633
I find that most ethical questions are pretty cut and dry when you're not trying to be annoying about it
 
@DSM unfortunately, it looks like the devs are set on trying this out despite the lukewarm reception
my hopes that they focus on their existing products continue to be sidelined
 
user559633
@AaronHall Just how big was it? ಠ‿ಠ
 
@tristan teach me your ascii art ways, master...
Sorry, couldn't resist
 
user559633
2:54 PM
@Programmer Get an editor that supports utf-8. Categorize by intent
 
DSM
Maintenance and support of existing tools: borrring. Nebulous new pool of awesomeness: not boring.
 
72
Q: Top generous users - users that spend their reputation in bounties

Thomas WellerI just came across an interesting user who has more gold badges than most top 20 users. The low reputation of below 10,000 made me wonder how that's possible. I found out that he's continuously spending his reputation on bounties. Would someone mind building a SEDE query that allows us to find t...

That's really interesting.
 
DSM
And for those keeping track at home: client from hell conversation went about as well as you'd expect a client from hell conversation to go. I was quite disappointed I arrived just in time for it.
 
@QuestionC There's nothing funny about COBOL programming
 
Cobol always reminded me of a Mortal Kombat character.
 
DSM
3:01 PM
Wouldn't that be Kobol?
 
aand google says: Kabal....that's why .... close enough
 
DSM
Ah, so it's like one of those three-consonant languages. You remembered K-B-L and the rest is vowel pointing. :-)
 
bingo
:)
 
Kobol was the planet in BSG
 
Kobolds are little goblin things in DnD-esque fantasy worlds.
 
DSM
3:10 PM
Kobolds? What's this crazy word. You mean a brownie, of course.
 
Nah, brownies are an offshoot of ouphe, while kobolds are their own species.
 
*idjaw rolls a 14
 
Well, I think I may have just written my longest running SQL query. It's 2 minutes in and nothing is displaying yet. Hooray for 4 self left joins.
 
rhubarb
 
DSM
3:17 PM
@Kevin: I'd be better situated to disagree if I'd had any idea what "ouphe" meant before two minutes ago.
 
I'm getting my classification system from MTG cards.
 
Would you tap a kobold? Etc
 
Doing so is usually impractical because they have 0 power.
 
ipython why you importing a windows-only module on my linux box? why? ;___;
 
DSM
@Ffisegydd: what one, if you don't mind my asking?
 
3:21 PM
Python why do you try and find a specific version of Visual Studio on my Windows box? :)
 
It wants to make a simple process into a convoluted one
 
@DSM ctypes.wintypes
 
DSM
@Kevin: oh, by the way, when I came in today your wavy-pic from yesterday was still waving.
@Fizzy: not sure I've seen that before, so I can't be any help, I'm afraid. :-/
 
I've made some marginal improvements to my wavy pic. It's got antialiasing now.
Apparently the only way to do this in PIL is to render at twice the desired size and then downsample at the end, which is dumb.
 
user559633
That's pretty Pythonic for images actually.
 
3:25 PM
The end result is better but the script takes four times as long to complete
 
user559633
Python for GUIs and Images, expect the worst.
 
@JRichardSnape Thanks! Looking into it, the size of the array is (640, 800), which is not RGB indeed. I need to either read the image different or approach this different. Thanks for the insight!
 
I was also able to reduce the file size by observing that the gif starts to repeat on the eighth frame, so I could remove the remaining 52 frames.
But this is only possible if frames evenly divides rotational_period / 2. Otherwise there is a small discontinuity.
 
DSM
Can you set animated gifs as your background on an Android phone? Apropos of nothing.
 
@DSM apparently this does it
 
DSM
3:29 PM
Excellent. </mr. burns>
 
@user4039874 no problem. If you don't need the intermediate openCV image, you can read the image direct into GTK. However, my guess is that in the end you will need to feed this from some openCV processing. Depending how you read - normally cv2.imread(<filename>) will return something that is e.g. (128 x 128 x 3)
 
Monetization strategy for my gif hobby spotted.
"Live wallpapers" appears to be a built-in feature of modern Android phones. Not sure how they differ from gifs.
 
@JRichardSnape That is exactly how I am reading the image. However I get a (640 x 800) image returned. I can try with a different image, though. And I do need to do opencv processing. Maybe even change the image and then display the changed image.
 
@Kevin Maybe they're more like shaders
 
At a glance, the default live wallpapers are a little more advanced, ex. a live stock ticker or a nonrepeating simulation of a fish tank
So they can do more than display a sequence of predetermined images.
 
3:38 PM
@user4039874 sure - I thought that would be the case. I tested with a .jpg. Are you using a monochrome bitmap or something, maybe?
 
Well I can't find any way to do it that is both free and doesn't impose ads/watermarks, so meh
 
@JRichardSnape I don't think so. I just locally stored a google image and try to read that.
 
I now need an animated fish tank wallpaper thanks Kevin
 
@user4039874 console session to show you what I'd expect (just done that live) dpaste.com/3G2JZF7. I haven't got GTK on this box to test the other half of the issue
If you add the same info as I put in there to your question, it will be much more answerable
 
14
Q: What information do you need when deciding whether to respond to first contact from a company?

Laura(For those who don't know me, I'm a product manager here at Stack Overflow.) I've spent a lot of time lately thinking about how to improve the developer experience on Stack Overflow Careers, especially for developers who have opted in to being messaged by companies that subscribe to our Candidat...

I can't think of an answer to that question that I want out there with my name on it...
 
user559633
3:46 PM
@AaronHall Yeah, same.
 
user559633
There's a disconnect here because SO wants to pretend that people using careers are developer-minded, but that's only on one side of the relationship
 
@JRichardSnape Thanks! I can now see something of an image, using flatten! it is very different from the initial image, but I have to look into that. Thanks a bunch!
 
How would this work: "We know your responsibilities are A, and you're being paid salary and bonus (specifically X), we want to give you more responsibilities (specifically B) and compensate you at a significantly higher level (specifically Y). Here's a 2 year contract, with perks C, D, and E."
 
user559633
How would they know your current salary?
 
DSM
For first contact, I mostly want to know they're paying attention. The last time I responded (because the company was interesting) I still wished the recruiter had been more specific about what they liked about what I was doing. ("I've noticed a lot of numpy and pandas answers -- we use them here too." or something.)
 
3:48 PM
waggles eyebrows
See, I kinda get why you want them to pay attention, but let's face it, they're all flakes struggling to meet a quota, and they're playing a numbers game.
 
I feel nothing but envy at that question. For me it conjures images developers whose inboxes are flooded with job offers like women on dating sites.
 
user559633
@QuestionC If you're actually in NYC (I peeked), just semi-maintain a linkedin and you'll be flooded with recruiter spam
 
I received exactly one message on my careers profile and it was essentially a polite "How much do I have to pay you?"
 
Yeah, I hear all these stories about having issues with having too many job offers. I've had 1. One job offer.
 
I've had 2 job offers, from interviews that came through recruiters knowing about me on LinkedIn
 
3:52 PM
Considering my experience with Django is 0, getting linkedin spam mentioning my vast Django experience doesn't excite me.
 
Wow that's kind of creepy. I don't think I updated my SO profile location. Conveniently creepy.
 
Good Networking. If you can network well, sometimes you have to fight them off with a stick.
 
user559633
I've received ~30 messages on careers.stackoverflow, where in almost all of them just looked at my current job title and tailored the message from there.
 
user559633
Benefit of being linked to my StackOverflow activity: None
 
Yeah the problem is it's still coming from a recruiter, and I want a message from the team lead/manager/director who wants to hire me
I get that they can't contact every potential person, but the internet makes that pretty easy to achieve
 
user559633
3:54 PM
@RobertGrant Yeah, this is exactly my point about with only one side of the relationship being technical.
 
Yeah
 
Also, people forgot that jobs are two sided things. You also have to interview the company to see if they've got what you want too
 
My recruiter experience was pretty positive. I am not into human networking. The APIs are too poorly documented.
6
 
Sometimes, that might be just "ANY MONEY PLEASE."
 
3:56 PM
If you wanted to get attention directly from your StackOverflow activity, you could use your profile like Martijn does. If desperate, maybe you could change your name to "My name - Hire me!" but you'll have to wait to change it back...
 
If I wanted more attention from SO, I would change my LinkedIn to be identical to Martijn's
 
The 8th level of network needs some serious documentation updates.
Maybe an RFC or twenty.
 
Regarding networking - You just gotta talk to people, see what they're doing, ask them about opportunities (when you need them) - but you gotta build those relationships in advance.
"Dig Your Well Before You're Thirsty"
 
I feel like I heard that recently... :D
 
user559633
 
3:59 PM
rbrb
 
Out of an if statement or a try/except, which has more overhead? I need to release a lock inside of a loop, but only the first time because otherwise it'll throw a RuntimeError.
 
user559633
@MorganThrapp what does your profiling show
 
So 30 days of "Aaron Hall - Hire Me!" would probably be rather unbearable.
 
user559633
ugh that meta post
 
user559633
4:03 PM
"i want to keep others from changing their names on a site because it mildly inconveniences me"
 
@tristan I was hoping to avoid profiling if there was an easy answer. This isn't something super easy to profile.
 
user559633
hell is other people
 
Broadly speaking, raising and catching an exception is pretty expensive.
 
Just do what I do and memorize everyone's user id.
 
user559633
depends how often the try/except will get hit -- boiling the error up the stack is the expensive part
 
4:04 PM
@Kevin That's what I figured. Thanks.
 
Exceptions should be exceptional.
 
DSM
I think tristan is right: if memory serves, trying is cheap, it's excepting which is the problem performance-wise.
 
It'll get hit ~10k times.
 
user559633
also depends on the cost of the if calculation
 
try is cheap
 
4:05 PM
Versus a simple boolean variable check.
 
Even if catching an exception is ten times as expensive as an if, it's still preferable if it only happens one in a million times.
 
except is expensive
 
user559633
if you have a if non_bool_non_char_comparison():, this gets interesting though
 
begins reciting the Zen of Python under his breath
 
user559633
but if it's a non-cell var and you're looping over what amounts to an if BOOL:, and you'd otherwise hit a try/except with some non-exceedingly rare frequency, use the if logic
 
4:07 PM
+1 to above comment
 
6
A: It looks like the duplicate banner changed. How does it work now?

Thomas OrozcoWe are making two changes to closure by users that own a gold badge: First, we're going to start looking at the question's current tags instead of its original tags, unless you were the one that edited them (either by doing it yourself, or by approving an edit from someone else). This is done ...

Edited tags count for the hammer now (or soon?).
 
user559633
boss: you're fired
mime: why
boss:
mime: oh right
 
DSM
For reasons already discussed I don't dup-CV much now that I have the hammer, but there are a few times I've wanted to swing but I don't own a python-2.4 gold badge or whatever. So I guess I'm happy.
 
Is there an easy way to check if filename is inside a directory, if directory is '/1/2/3/4' and filename is '/1/2/3/4/5/6/file.ext'?
 
that's a weird filename
 
4:21 PM
both directory and filename are strings
 
if filename.startswith(directory):
 
What about '/1/2/3/44/5/6/file.ext'?
 
maybe I'm missing something
 
DSM
Yeah, startswith could get you into containment problems.
 
Then it fails
 
4:22 PM
but why not use os.path.isfile ?
am I missing something obvious?
ooooh I get it
nevermind
 
suppose filename is r'C:\stuff\output.txt', and directory is r'C:\Program Files'. filename is a file, but it's not in directory.
 
In [1]: import pathlib

In [2]: dir, file = pathlib.Path('/1/2/3/4'), pathlib.Path('/1/2/3/4/5/6/file.ext')

In [3]: dir.parts == file.parts[:len(dir.parts)]
Out[3]: True
But this is ugly and probably pretty slow
 
all(a == b for a, b in zip(directory.split("/"), filename.split("/"))
 
Oh. Maybe it'll work
well, I used pathlib because it's cross-platform
I guess I'll have to use os.sep
In [12]: all(x == y for x, y in zip(dir.parts, file.parts))
Out[12]: True
Thanks @Kevin :)
 
DSM
I dunno about that. What if file.parts is shorter than dir.parts?
 
4:36 PM
ugh, right
maybe I'm missing something obvious :D
 
Depends on whether you're only testing things that you know are actual files.
directory = "1/2/3/4/5", filename = "1/2/3/4"` will incorrectly give True for my approach, but directory = "1/2/3/4/5", filename = "1/2/foo.txt" will correctly give False.
The only time you should get a false value is when filename is actually a directory, which the directory value happens to be a sub-directory of
 
I have a question. What scenario will it be true that you will have a filename as "1/2/3/foo.txt"?
 
DSM
That sounds almost like a dare.
 
Let's assume that relative directories are allowed, so we don't have to use examples that start with "C:/" all the time
 
@DSM I declare a dare
I'm going to try to create a file like that on my end
 
4:41 PM
Suppose I call resolve() on every Path instance, so that the paths are always absolute
 
To be clear, I'm assuming "filename" means "a filename plus its directory". The filename isn't literally named "1/2/3/foo.txt", it's named "foo.txt" and exists in the "1/2/3" directory
 
then I go back to my question. What is wrong with 'isfile'?
 
Or rather, exists in the "3" directory which exists in the "2" directory which exists in the "1" directory
 
DSM
isfile wouldn't address the containment part of the question.
 
Like I said before the last time you asked:
18 mins ago, by Kevin
suppose filename is r'C:\stuff\output.txt', and directory is r'C:\Program Files'. filename is a file, but it's not in directory.
 
4:42 PM
thanks for clarifying
so what if you did basename of r'C:\stuff\output.txt' then join on r'C:\Program Files' with filename and then did an isfile on that
 
Ideally, the algorithm wouldn't even look at the file system. It should be able to tell if some hypothetical filename-plus-full-path is in some hypothetical directory, even if neither of them are real
 
oooh
ok...sorry...I'll go back to my cave
 
DSM
It's warm there. There are no bears.
 
(This message brought to you by the Brotherhood of Hungry Bears)
 
DSM
One of my all-time favourite corvid lines was "outside? But that's where bears are". Still makes me smile.
 
4:46 PM
@vaultah maybe something with commonprefix?
so if the common prefix is equal to the first directory, then the file is a descendant of the directory
 
DSM
os.path.commonprefix(["/a/bc/d", "/a/b"]) == '/a/b'. The function is frankly silly.
 
Oh, yeah, that's dumb. Why doesn't something in os.path understand the path?
but I think it would still work in this case, the way I described
 
I'm trying to answer this question using filenames
 
Huh. My CSV writer isn't writing out all of the columns I pass it. :/
 
DSM
4:57 PM
Yes, it is. #psychic
(That's ambiguous enough that I can probably spin it regardless of the truth of the situation, so yay me.)
 
@MartijnPieters I knew there would be a dupe for that. stackoverflow.com/q/33021686
 
Every day I am tempted multiple times to just write completely contrary comments. "I'm getting this output..." "No, you aren't."
 
Nah, I checked the list I pass it in the debugger, and it has 54 columns (exactly what I expect), but it's only writing 14.
 
"I tried [technique] but it didn't work" "No, that technique works."
 
I thought it might have something to do with blank columns, but it's writing out some of the blank columns.
 
DSM
4:58 PM
@MorganThrapp: how do you know it's only writing fourteen?
 
@DSM Because I can see the csv it wrote.
 
DSM
That might show the final CSV has 14. It doesn't prove it's only writing fourteen. Maybe it writes 54 and then writes only 14 later because you have 'w' where you meant 'a' or something. Etc. There are still a lot of steps between writer.writerow(something_with_54) and you looking at the output..
 
It's writing out the right number of rows, and the column count is consistent over each row.
 
Hrmz, @poke, not sure why Ethan Furman needed to downvote our answers.
Was it so unhelpful as to name just one way to add a class attribute in my answer?
 
DSM
The odds that writerow is just skipping some columns are really very low. Can you reduce it to an mcve?
 
5:02 PM
cbg
 
DSM
(Odds are? Odds is? Odds are.)
 
@DSM Maybe? Let me see what I can do.
 
@Kevin you were nicer than me on that question :P
 
I was aiming for 80% snarky, 20% legitimately helpful if OP literally does not know how to do multiplication at all.
More likely, he knows how to multiply, but doesn't know how to calculate 20% of a value.
 
wo, Reddit is written in Python.
nice
 
5:10 PM
Thank you :D so helpful :) — Chris Beldam 6 mins ago
Not sure if sarcasm...
[suspicious_fry.gif]
 
wow two smileys. I hope you like those more than accepts :)
 
I can't use a context manager to "patch" sys.excepthook, can I? 😢
 
I don't see why not. I've patched sys.stdout with a context manager, so it should be the same in principle, yeah?
 
I mean patch without losing its functionality
 
Ok, so make the new excepthook call the old excepthook.
Ah, I'm guessing __exit__ gets called before excepthook does
 
5:17 PM
Yup
 
In that case, I changed my mind. You can't, because the context manager exits before Python tries to handle an uncaught exception.
 
@Kevin I'm bad at explaining and I'm terrible at explaining in English. Thank you for guessing right :P
 
Is there a Python web framework that doesn't use ORM?
 
I don't think Flask does by default, does it?
But most people add SQLAlchemy
 
DSM
Yeah, flask doesn't mandate that you use one if you don't want to.
 
5:20 PM
hm,good
 
RIP I don't get Monday off
 
DSM
(Or use any database at all, come to think of it. JSON dumps it is!)
 
I don't want to use Django for my next project
because I have to hook to its eco-system
 
DSM
Then find whoever's forcing you to and discover his favourite restaurant. Then bribe the chefs at said restaurant to refuse to serve him until he renounces his Django demand.
 
user559633
@Programmer me neither. if we aren't respecting an italian mercenary explorer who thought the caribbean was india, then what's the point of anything
 
5:23 PM
@DSM great imagination man :D
 
user559633
you can use django and just not use its ORM. i wouldn't, but you could
 
DSM
Second Monday of October is Thanksgiving for me, so a holiday it is.
 
@tristan yeah I wouldn't too :D
@Programmer how is VB going?
 
is VB seriously still going!? :p
 
If I get a day off from work paid, I'm not complaining.
 
5:27 PM
@JonClements Some unfortunate people still have to touch it.
 
@khajvah I'm pulled from that for now :p
 
I was forced to use it in 2001 - not the most fun project of my life
 
was anything really fun in 2001 for programming?
 
user559633
@Programmer C, C++, PHP?
 
not that it's fun in 2015 with most stuff being JavaScript
 
5:29 PM
Gross languages, I thought so
 
user559633
>___>
 
well yeah... because there's always "new" stuff, but that's relative - so there was a lot of exciting stuff... not so much so now, but at the time
 
@Programmer C++ is ok
ish
 
I didn't do much in C++ as compared to C, but it didn't seem all that much different
 
oh those are really different (not sure if they were in 2001)
 
DSM
5:32 PM
Modern C++, i.e. C++11 and beyond, is tolerable. It still seems greatly overcomplicated to me, but at least you can loop over an iterable without drowning in < and >.
 
it is, for sure, ugly but it has garbage collectors and stuff
I have a professor who is still having fun with C and assembly. In fact, he considers C to be too high level.
 
Possibly he may be some way away from inventing the next facebook
 
:D
 
C++11 further emphasizes the language's chainsaw-like nature.
 
Next version after C++11 will just be Chainsword. ASCII just doesn't cut it. A Chainsword cuts it.
 
user559633
5:42 PM
@QuestionC What do you mean by chainsaw-like?
 
Except lambdas (the notation of which is hilariously C++-esque) and auto, the new features are things most programmers won't be able to use for any purpose other than causing mysterious core dumps.
 
poor guys are still waiting for module support
 
user559633
e.g. this? "Writing in C or C++ is like running a chain saw with all the safety guards removed," — Bob Gray.
 
I know this feel
 
c++11 is perfectly safe though
 
5:43 PM
this damn simple code is not working
 
user559633
if you point a gun at your foot and pull the trigger without checking if the safety is on and you lose some toes, that's on you compadre
 
@tristan Yea basically. The idea is that it's really powerful but it's gonna cut your leg off.
 
user559633
At least it's only computers.
 
@QuestionC I thought you also meant that C++11 sort of vaguely looks like a chainsaw
 
C++ looks like a piece of crap.
not chainsaw
 
5:48 PM
I figured it had something to do with the aforementioned "<" and ">" characters, which resemble chainsaw teeth
 
You guys tomato at metaphors.
 
beep boop does not compute
 
std::reverse_iterator<std::string::iterator> r = s.rbegin();
beauty
 
auto r = s.rbegin();?
 
still
doens't change the fact that its type is std::reverse_iterator<std::string::iterator>
 
> [json.loads is] bad because internally that parser obviously had to deal with taking bytes and making them into Python objects to begin with so it's just removed functionality.
I've used languages where you have to call half a dozen functions in order to do the same thing loads does. I do not think those languages have the superior approach.
 

« first day (1818 days earlier)      last day (3146 days later) »