« first day (2665 days earlier)      last day (2282 days later) » 
00:00 - 18:0018:00 - 00:00

12:45 AM
Anyone know a dupe for "I'm looking at the repr of a string and I want to remove those backslashes that don't actually exist"?
there's this, but it's closed as off-topic
Perhaps I should ask a mod to reopen that?
 
why?
a brain fart is a dupe of a brain fart
 
it's a common question.
 
or is it impossible to dupe with a closed post?
 
no idea, actually. Never thought to try O.o
But I mean, if we're gonna keep it around as our canonical dupe, it's kinda stupid if it's closed. If it's useful, it shouldn't be closed.
 
I disagree.
"useful" -/-> on topic
if every week someone asks for the best Beef Wellington recipe, it makes sense to keep the oldest post closed and dupe the newer recipe requests to that
 
12:52 AM
So why exactly isn't it on topic?
 
that's a different matter altogether
 
Ok, you got me there
 
all I'm saying is that the fact that many people have the same problem doesn't make it automatically reopenable
 
There's this old "Why do backslashes appear twice?" post by Zero
 
Oh, that helps. That's a good one. Favorited. (link for the lazy and interested)
I can already picture the n00bs responding with "ok, but how do I remove the backslashes?" even after they've been linked to that answer because str.replace doesn't appear anywhere in it and because of that they only skimmed it
 
1:12 AM
if anyone ever looks at my favorited posts they'll wonder why there's so much trivial stuff in there
Is there a way to find my own deleted comments? More accurately, comments I've posted on a question or answer that's been deleted?
 
nope
unless SEDE voodoo
 
no thanks, it's not important enough to make me dabble in voodoo
 
comments are only searchable in SEDE to begin with, as far as I know
 
unfortunately for me, most of my interaction with SO is done through comments :/
 
wim
1:43 AM
@Rawing Zero's post could do with this example or something like it
>>> len('a\\b')
3
 
Ooh, I like that.
 
Hmm.
 
Might also be a good idea to rephrase the title a little - at the moment it only mentions double backslashes and no other escape sequences.
@ZeroPiraeus Is it a coincidence that you're here or were you attracted by the upvotes on your old post? :p
 
That is indeed a useful mind-nudger<sup>*</sup>, but I can't immediately see how to jam it into my answer.
@Rawing Coincidence in fact.
Also: what, no <sup>? For shame.
 
I guess upvotes on old posts are a more regular occurence for you than they are for me. I probably shouldn't assume that you noticed them at all.
 
1:49 AM
<sup>*</sup> (lets just pretend) I think there must be an actual word for "mind-nudger", but I'm one bottle of wine and a cocktail in, and my English vocabulary tends to suffer in such circumstances these days.
Oh, I notice every single one :-)
Anyway, I wouldn't object in the slightest if someone here were to put together a decent answer to the double backslash canonical that attacks the issue from a different direction. Might even upvote it ;-)
 
look at the rich guy rattling his purse...
 
Unfortunately, I'm no good at explaining things.
 
 
5 hours later…
6:35 AM
cbg
 
cbg
 
6:50 AM
cbg
 
7:28 AM
cbg
 
8:00 AM
cbg
 
cbg
 
9:12 AM
cbg
 
10:11 AM
 
10:24 AM
yesterday, by davidism
Don't do that. Use tags sparingly.
@Rawing enjoy your stay in prison, desperado!
 
ooops, I forgot :(
If nobody tells him, it'll be fine. I hope nobody snitches >:I
 
Cabbage
@FlorianMargaine How do you do meta tags? :o [tag:meta:foo]?
 
[meta-tag:foo]
 
@Rawing did you mean ? :D
 
10:33 AM
yes! Are we all going to davidism prison together? :D
 
Better than fixing unit test all day, so I'm in.
 
@ArneRecknagel I love fixing tests
usually means so many uncovered bugs
(and, really, pytest is a thing of a beauty.)
 
@FlorianMargaine Since working on a web application, writing tests mostly consists of finding ways to trick or mock authentication though. So I don't barely even get to fix bugs in the codebase =(
 
jjj
cabbage
 
11:33 AM
Hello all. I want to use pyhive/phys2 library. I installed pyhive, but when I use it in a program I get an Import error:No sasl module found. So i pip installed sasl. Then I am getting: sasl/saslwrapper.cpp(247) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
error: command 'C:\Users\Imdad\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe' failed with exit status 2
 
 
1 hour later…
12:38 PM
@poke I posted one yesterday and you didn't ask me :(
 
Was that during that “let’s all write in tags” moment?
 
I wasn’t around during that time
 
excuses!
 
1:08 PM
cbg!
I'm new to flask and I am returning JSON object from a method like this: return jsonify(words)
Now I want to add extended headers too... like this:
resp = make_response("Hello World", 200)
resp.headers.extend({'X-Powered-By': 'AT-5000'})
return resp
Can someone tell me how to return both header and JSON object from a method?
 
You can return multiple values from a function*: return a,b
(*ok, technically you're returning a single value, a tuple, which contains multiple values. But it kind of looks like returning multiple values if you leave out the parentheses. And the outcome is the same.)
 
So it will return JSON object and and update the headers too?
 
I don't know enough about flask to answer that definitively.
 
Trying, if that works I'm gonna die out of shame.
 
Going by the principle of "programs only do what you tell them to do" and you didn't tell it to update the headers, I'm guessing that the headers will not be updated.
Unless you extending the headers is the same as updating the headers. I don't know what kind of terminology we're working with here
 
jjj
1:19 PM
@Grimlock Don't do that. It's ok not to know things. I think.
 
Lol, just figure of speech. But thanks ;)
 
@jjj Do you just think that, or do you know that? :P
 
jjj
I'm really not sure. I think it depends on who is around.
 
:D
 
I'm retrieving data from a json, and want to turn datetime strings into datetime objects on load. They are even conveniently tagged as such. Currently I am helping myself with this, but ti feels kinda bad:
 # what the json looks like: [{ "case_id": 42, "birthday": "19920731"}]
payload = [
    {key: datetime.strptime(val, '%Y%m%d') if key == 'birthday'
    else val for key, val in entry.items()}
    for entry in self.get_data(fname)
]
 
1:25 PM
I'm thinking maybe
payload = self.get_data(fname)
for entry in payload:
    entry["birthday"] = datetime.strptime(entry["birthday"], '%Y%m%d')
 
Much less cumbersome, but two lines
will still use it, probably
 
3 lines instead of 5 :P
 
I probably meant two additional lines
that's the only way i can read my comment without looking like a fool, so that's what I am going to go with
ah, the 5 lines part didn't compute. today really is not my day :o
 
@Kevin Not reproducible now
 
Another job well done.
 
bah I'm hungry
 
I was half tempted to write a scathing rebuttal of "the exact details probably isn't important" because they are important so very often
 
that rebuttal would've been a paddlin' oh that's a direct quote from sad sad OP
 
2:01 PM
I'll just leave a smug parting shot, I think
 
I understood "rebuttal of" as "rebuttal in the form of" rather than "rebuttal to their remark"
 
I should keep a compendium of English ambiguities, given how often they come up in here
 
I have self-generated confusion anyway
 
DSM
Snowy and warm! Best weather cabbage ever!!
 
Just posted an answer to a question which lead me to another question for myself. Reading a files lines. Is it better to do a for loop to read each line and append it to a list or is the function readlines() faster? Or are they near to the same?
 
2:11 PM
I'd expect readlines to be faster.
Generally, if you have a choice between composing a list yourself and letting Python do it, Python will do it faster because it can take shortcuts using C-level magic that you don't have access to
Computational complexity will still be the same though so in the end it's mostly not worth worrying about until you're in the stage of "my program is slow, what's the bottleneck?"
 
@DSM disagreeing-cbg :D
 
I see I see. Yeah I just was curios as the other person on here kept the for loop for it but I did readlines. stackoverflow.com/questions/48564565/…
 
snow + clear skies + chilly -10 C = best weather :D
 
@ZackTarr The fastest solution is to omit readlines and iterate over the file directly :)
 
Oh, well, if you're going to iterate through lines anyway, you may as well skip it and do for line in file:
 
2:16 PM
Noted. Thats why I came in here to ask! Thanks guys.
 
@Rawing I got to agree, python thought me to be lazy for things like parsing, and it usually speeds up things a lot, especially debugging
 
Would the last answer though be the best fit? With the set() piece? I havent used that any.
 
And only read a whole file if you know that you are actually going to use it
 
Whenever you see a problem with a phrase like "if the thing isn't in the list, add it to the list", that's a huge huge red flag to use a set
 
Im guessing its better to check for the word being in the list as you go rather than trying to fix a bigger list in the end?
 
2:19 PM
cbg
 
Given only those two options? Yeah. But a set blows both out of the water.
 
This one needs MCVE. I put a comment on there but figured I would share. stackoverflow.com/questions/48557619/…
Interesting. So what would be a time to use a set?
 
bag of unique (and hashable) elements
 
Sets are best used when you want to eliminate duplicates, or don't mind duplicates being eliminated; and if you don't mind that the collection will be unordered.
 
I see. But as to your comment of a huge red flag. Are you saying this would be a time to use a set or not?
 
2:24 PM
That makes sets sound very niche
 
In exchange for meeting these requirements, you will be blessed with O(1) membership checking, which is much nicer than the O(N) membership checking that lists have
x in my_thing will fly like the wind
 
@Rawing they are very niche, aren't they? More often than not you want dicts
 
@ZackTarr Yeah, this is a good time. OP wants to eliminate duplicates, and since he's creating a sorted collection at the end, he doesn't care about the order of the intermediate object.
 
I was just confused then on that first comment. I thought you meant this was not a good time to use them, and then said they are great at eliminating duplicates which is what they are doing.
 
@AndrasDeak Well sure dicts are used a lot more than sets, but sets aren't exactly rare either. In my own code, at least.
 
2:28 PM
In retrospect "red flag" is a poor choice of words since it tinges the entire scenario with a haze of "this is bad"
"that's a huge huge indication to use a set" would be more appropriately neutral
 
Thats how I took it but I havent had my coffee yet so Im chalking it up to that.
 
@Rawing perhaps the kind of problems you usually have to handle involves a lot of uniqueness :) Mine don't
 
cbg
Is anyone here a fan of putting code in their __init__?
I never adopted this for my own code. I see it a lot. And I understand its purpose and all that. But.....I just never want to do it.
 
cbg
 
I'm looking for arguments to convince me to adopt this in my life :D
Because I don't like doing it
 
2:36 PM
__init__() or __init__.py? :D
 
.py
should have clarified that thanks.
 
isn't the real question whether you want to have code executed on import or not?
Or what is "code" here? I often see star imports from submodules
 
class Foo:
    pass
so it wouldn't be executed. It's just there to facilitate importing
 
for instance, np.unique is actally in np.lib.arraysetops.unique, but it gets imported into the main namespace
 
I just intuitively never think to ever go to __init__.py to look at code
so to me it just doesn't seem "explicit"
Exactly. That np.unique is a good example, per what I said about facilitating imports
But, there could have been another strategy adopted to still allow that kind of import and not use __init__.py.
 
2:39 PM
Such as?
 
Therein lies the question, friend.
Therein lies the question.
 
Ah. If you want to preserve that submodule structure, I'm not sure there is one. Plus this usually involves star imports plus __all__, and that might make __init__.py a great candidate ;)
 
wait....
 
the moment you import numpy as np the only thing that gets executed is __init__.py, right?
 
yes
OK. This makes sense.
I see it
 
2:42 PM
don't step into the light ;)
 
Which now takes me to the code I'm looking at, and realizing that it is utilizing __init__.py poorly
This really clarifies everything now. This now allows me to nuke that code outside of the __init__.py
oh this will feel good
 
well I'm sure there are other legit applications of the file, but the one I often see and understand is this use case
 
That makes the most sense to me.
 
whatever you need to get in a nukey mindset :D
 
I'm glad you understand me. I can always count on you.
 
2:47 PM
o.o
 
Boy, I think I've seen 5 questions being deleted and reposted in the last 2 days. With literally no improvement, at that.
 
It's just life wanting to play wack-a-mole with you
 
please,I am posting same question from different account for 3 times and I am always seeing only downvote only please if some one who think I need to be helped then please help me. — Hamis Dunduwala 4 mins ago
facedesk
 
*sigh*
 
Morning cabbage
 
2:50 PM
morning cabbage \o
 
> Firstly I have this long string
> `s = '1MichaelAngelo'`
Lost it there.
 
I'm not sure so many people arguing with that user in comments will prove fruitful.
 
I don't get it .... sorry @poke
 
I don’t consider len( '1MichaelAngelo') = 14 to be very long.
 
"The rules should be ignored for me because helping people is the goal of the site and I don't understand what the Tragedy Of The Commons is" is pretty tiresome at this point
 
2:54 PM
@poke I thought you had a problem with the spelling of Michelangelo
also why is someone posting their password :P
 
Oh, sorry :(
 
yeah I thought it was something about the string, not the length :\
 
For fairness, the title said this: “How do I split a Very huge string”
 
So I was expecting an actually long string.
 
2:56 PM
Very = operator.not_
 
xD
 
?????
 
@MooingRawr xD xD
 
@poke lol
 
2:58 PM
You’re hilarious
 
Hmm, I'm trying to evenly blend together an arbitrary number of PIL Image objects. The Image class has a blend method, but it can only blend two images together. I could iteratively blend each image into the total result, decreasing the weight of each frame as I go, but I worry that this will accumulate errors thanks to floating point inaccuracy.
So basically
def blend(images):
    result = images[0]
    for i, img in enumerate(images[1:], 1):
        result = Image.blend(result, img, float(1)/(i+1))
    return result
 
@Kevin Can I just say that I love how the problems you encounter and talk about here are as unrelated as they could possibly get? There just appears to be no common narrative in what you do :D
 
Don't question the star lord :O /jk
 
You could also implement a multi-blend method yourself that works by looking at the pixels of all your images
 
that sounds slooooow
 
3:02 PM
@MooingRawr I don't think that should be joke. The star lord should indeed never be questioned. This is why he is named Kevin.
 
What about those who are also named Kevin, but isn't a star lord status ?
 
If you meet the Buddha Kevin on the road, kill him
 
@Rawing Believe it or not but the actual 2-blend method works that way too
 
I could do a divide-and-conquer style thing that tries to maximize the number of calls to blend that have a power-of-two argument to alpha. Since those would all be perfectly accurate.
So on average I'd have log(N) inaccurate blends instead of... N-log(N)?
This is all a premature optimization since the difference is probably completely invisible to the naked eye
 
@Kevin why not numpy?
 
3:11 PM
Because I don't know how to use it.
 
I can :)
 
I'm playing around with ways to do motion blur in gifs. Here is a comparison of the same gif with 0, 1, 2, 4, 8, 16, 32, and 64 frames of blur
 
and you can extract a numpy array from a PIL object I think
wait, what is "blend"?
if it's just averaging then it's as simple as result += next_img/N in a loop
 
The docs describe it as out = image1 * (1.0 - alpha) + image2 * alpha. So, average with customizable weight.
 
(or 1/N in the end once, etc.)
 
3:12 PM
result += next_img/N is effectively what I'm doing. I'm just fretting about whether 1/N is cleanly representable as a float
I dimly recall that adding floats of differing sizes can clobber the contribution of the smaller one
 
I don't think you can get around that, other than putting the division last
no matter how you add 1 small float to 9 large ones, floating-point problems should be the same
you can probably minimize problems by summing all the arrays and dividing in a final step once
my gut feeling is that's the best you can get
 
user image
9
 
What I'm really interested in is calculating continuous blur. sampling N frames between times T1 and T2 and averaging them all together is well and good, but what if I could have N approach infinity?
I may need to reinvent calculus for this one.
 
“what if I could have N approach infinity?”MemoryError?
 
nope, just Inf due to double limitations ;)
 
3:19 PM
@AndrasDeak N approaching infinity many frames (i.e. images)?
 
If you can find the area under the curve by calculating the area of an infinite number of vanishingly thin trapezoids without getting a MemoryError, then you can find the exact height of a slice of a cylinder skewed radially around a central axis without getting a MemoryError.
 
@Kevin if you have two frames anyway, you can construct a continuous interpolator as image1 * (1.0 - alpha) + image2 * alpha just like you wrote, with alpha a continuous parameter fro T1 (alpha=0) to T2 (alpha=1)
and no algorithm will invent missing frames for you
(unless you do higher-order interpolation etc.)
@poke well if they are stored on an inifitely large SSD...
you can still sum them without memoryerror
 
@Kevin Technically, motion blur is exactly that though. The thing that is looking at the motion is getting hit by moving light, blending the lights with each other. So you should be able to blend them just by equally taking “light” from each frame.
 
Ah, Celeste. I picked it up this weekend. I can't play too long before my hand cramps up so progress is slow-going.
 
3:23 PM
@Kevin I got it for the Switch, it controls pretty well on it.
All the moves are mapped to multiple buttons, had to experiment a bit to find a comfortable setup.
 
I got it for the PC. When I launch it from Steam, it churns for about three minutes before the game window appears. I wonder if this is normal.
 
did you get the new Monster Hunter for the switch?
 
I keep stopping just because I'm not trained to push through tough parts anymore.
@MooingRawr it's not for Switch, otherwise I totally would.
 
looking at the trailer, I'd die sooooo many times
 
My death count has been around 200 each for the first three stages.
But I haven't tried to get all the collectibles or extra levels.
 
3:26 PM
I have the fortitude to die a zillion times on one screen, but only if it's necessary to progress the game. If it's an optional strawberry, I'll give up after a dozen deaths or so.
 
I can't wait for the new Monster Hunter for the switch
 
Is it supposed to come out for Switch? I hadn't seen anything.
 
There was a video on Reddit yesterday showing the final optional collectible in the game and I can tell you with certainty that I am not going to 100% this thing
 
The C-Side levels are insane.
I couldn't even deal with stage 1's B-Side yet.
 
Oh Monster Hunter XX is for the switch not Monster Hunter Worlds (new one) darn... welp another reason to delay getting the swtich
 
3:29 PM
Switch is worth it just for Xenoblade Chronicles 2.
 
I got 100-ish hours of entertainment out of Mario and Zelda so that's justified my Switch purchase even if I never buy another game.
 
I already beat Breath of the Wild on Wii U otherwise I would have got it on Switch.
 
I skipped the Wii U generation, so easy choice for me there.
 
The Wii U has a way better selection with the virtual consoles. It's just so clunky compared to the Switch.
 
agreed
Also. What would be amazing if there is a future Switch release that lets you play your 3DS games (in non 3d mode)
 
3:33 PM
I'm not too keen on virtual console games. If I don't have a physical game, I'll forget that I own it.
 
It might be hard to incorporate that with the physical cartridges. But if they opened it up for virtual 3ds games to be on the switch that would be amazing
I'm ok with virtual games as long as I am always and forever the owner.
 
I might occasionally mill through my old consoles and think "I should play Metroid Prime again..." because the box is right there. But I'm not going to think "I should play Super Metroid again" because it's buried three menus deep in the Wii menu
 
beat Mario and Zelda on the Switch and those are the only two games I have D:
 
I "own" about eight games I got from Humble Bundles that I can no longer play because I misplaced the purchase confirmation email
 
3:38 PM
Probably I could reclaim them with one polite email, but... Meh.
 
#python news: Python 3.7 beta 1 was released today. Now you can get all the features of the new dataclasses module. $ pip install attrs
A+ burn at people complaining about dataclasses.
 
DSM
I haven't decided yet what I think about them, other than that I'd like to double down on my predictions re: typing moving from optional to conventional to best practice.
 
I like typing
so far, I'm taking the option
I don't get dataclasses yet. I'll find something useful to read in a bit.
And, @davidism I don't quite understand the burn. All these things I don't get, do I need coffee?
 
I often find myself wishing that I could create plain-old-data classes without too much boilerplate, so this seems like a nice addition for me
 
I manually compiled 4 libraries to get them to work in my code, that is how much I like them.
 
3:51 PM
I hope it becomes wildly popular so that I can use them in SO answers without the OP saying "oh, sorry, I'm still on 3.6, can you write the class the long way?"
I want to be able to flip my scarf dismissively and say "darling, anybody who's anybody is using 3.7 these days" and drive off in my convertible
 
DSM
Doubtless I'll wind up using them myself, but it's worth remembering what Guido's PEP promises are worth:
> It should also be emphasized that Python will remain a dynamically typed language, and the authors have no desire to ever make type hints mandatory, even by convention.
That didn't even make it three years.
We now have an officially blessed datastructure which will become the new One Obvious Way to do lots of things which requires type hints (it won't actually check them, but it would make no sense to put in type hints which aren't accurate), so now they're already mandatory by convention.
 
The thing is, dynamic typing can be useful. I don't want to see it go away. However, it may be that you need to justify it.
 
I get your point, although I'm not so confident it will become the One Obvious Way to do the things it's good for.
 
DSM
I'll take that bet. My predictions on this front have been depressingly accurate.
 
I don't feel like it breaks with the dynamical philosophy. I use a dataclass exactly once in my code, at the one point where I pull all communication from database, web API, and potential other-language-libs. That way I can avoid type checking everywhere else.
 
3:58 PM
Which cynicism is stronger: the cynicism of assuming that the language will drift in a direction it shouldn't, or the cynicism that most users will ignore everything other than the core features that have been around forever? :-P
 
DSM
@piRSquared: but if I decide that static type checking is important, why wouldn't I use a language which actually really supports it, rather than Python's halfhearted version? Why wouldn't I use a language which also gives me some of the speed benefits which can come from type information? In the current arrangement I get most of the costs and relatively little of the benefit.
Admittedly I write mostly numerical and data-heavy code, so other people's experiences may differ.
 
@DSM Beecaauusseee..... You've drank the Kool-Aid!
 
@DSM Other languages have their own problems. If I can get a statically typed python, I'll take it :)
 
DSM
@Rawing: this isn't aimed at you personally, but I get a little frustrated in general with the "no language is perfect" response to "certain changes in Python may not be improvements".
 
I don't use Python because of dynamic typing. I use Python because of ease to implement, Ease of communication to fellow researchers, State of the art libraries, and most importantly, the community (that means you guys). If we as a community move towards more static typing, I'm still sticking with Python.

Unless of course it gets difficult to implement, difficult to communicate to fellow researchers, and libraries start to stink.
 
4:06 PM
@DSM Ah, it was actually supposed to answer the "why wouldn't I use a language which actually really supports it?" part of what you said. Whether it's an improvement is a different question.
 
DSM
Of course, that isn't programming-language-specific, though. Lots of people say "we need to embrace change" when I ask questions like "why are we switching to this new process which seems worse than the previous one?" as if that's responsive. Change is just change, it's not automatically a positive.
 
First mate: We're lost at sea!
Captain: no matter how far you go, you never reach the horizon. #blessed #liveLaughLove
Both: [die of dehydration]
 
DSM
@Rawing: other languages do have their problems, but they also have advantages Python doesn't, and they're changing (and potentially improving) as well. The recent changes in Python are repositioning it in the space of all programming languages, which will probably be a net benefit for some people and a net loss for others, and even in the unlikely case there's exactly no net change it will change the merits of Python with respect to other languages (e.g. Julia for numericists like me.)
 
That perfection is unattainable, is not a good reason to stop trying to improve.
 
4:17 PM
@DSM I think we're talking about different things. I agree with everything you've said. Can we pretend I didn't say anything? :D
 
(hmm I guess that doesn't fit perfectly in this context because the proponents of type annotation aren't saying "let's put this in because it's pointless to try to improve", they're saying "doing this will improve things" and there's a disagreement about whether that is a true statement. But I can't put that in a pithy statement that would fit on a throw pillow.)
 
DSM
@Rawing: ehh, ignore me, I'm just venting. Happens every six months or so on this subject.
 
It can be a large pillow and I'll still throw it
 
I mean, how big does a pillow need to be before you can't throw it?
 
Good point. Any statement can fit on a pillow if it's large enough.
I want a pillow with that "what did you say about me, you little punk?" meme cross-stitched into it
 
4:20 PM
As Pillow Mass -> Large; Shape matters more in regards to throwing.

Body pillows are difficult to throw.
 
Because you're emotionally attached to the depiction of your waifu on either side. Mm hmm.
 
@DSM because python has minimal fluff?
 
But it becomes fluffier as type annotation becomes mandatorier.
 
Mandatorier, my least favorite breed of dog.
 
Oh snap, I think this postponed evaluation of type hints will break a lot of my code...
 
4:26 PM
@Kevin no response
 
@piRSquared long time no see Sir. How's tricks?
 
Hey @AndyK things are good. I'm likely to disappear again at any moment. Life can get pretty hectic on a moments notice
 
@piRSquared One word, Life
:)
time to head to my conf
rb tomo
 
gots me a new 3.7beta, for the first time with optimization (whatever that might do)
 
@piRSquared Not so, you just need to have a javelin/shotput or rugby pass style motion.
 
4:35 PM
@DSM Because of hate for curly braces?
 
@toonarmycaptain Revenge of the Nerds style javelin throw ought to do it. youtube.com/watch?v=kmTbhZCxq9s
 
The correct reason to keep using Python is: so you can continue to receive my sage wisdom.
 
@Kevin Wisdom maybe, what exact, erm, herb, it consists of is debatable.
 
DSM
@poke: what curly braces? ;-)
 
Parsley wisdom: looks good, adds no constructive value.
 
4:38 PM
@DSM :)
 
DSM
Hey, I like adding parsley to my dollar-store stew. Makes me feel sophisticated.
 
But the sophistication was within you all along!
 
DSM
\o/
 
TIL Julia is a mixture of dynamically and statically typed
 
I don't want to do a whole bunch of modding to specify types in all my code...not that I've a huge codebase to modify atm. Surely there's an inbetween where you can turn it on optionally, but it takes the first type passed, and assumes (unless specified otherwise) that that first type passed is the type that will be passed in future, and go from there?
 
4:42 PM
I wonder if there are any languages that consider it a compile-time error to have a statement that can't ever run because of an earlier return.
 
That's how it is in java I think.
 
 
1 hour later…
5:46 PM
I never thought to try that. I wonder how many languages warn versus error. Especially langs with lifetime considerations like C++ / Rust.
Clearly the conclusion we can draw is languages should be expression-only so this can't even happen. Yes, I was learning haskell last night, why do you ask
 
I'm trying to think if there are any corner cases that would make it computationally expensive to determine if a statement is unreachable. You don't want to embed NP-hard problems into your compilation step.
 
the "can this point in the code ever be reached" problem is equivalent to the halting problem, is it not?
 
I'm not sure about that, that would only apply to i=2; if (i>2) {} blocks
 
if goldbachs_conjecture_is_true():
    return 1
return 2
 
Presumably the compiler walks the syntax tree, and it can notice that there's a single line of execution (no branches, no gotos) and it finds a return.
 
5:51 PM
Unclear whether return 2 ever evaluates.
Perhaps we can charitably assume that any conditional is capable of evaluating to either true or false, for the purposes of unreachability
 
That sounds like the setup for a joke. "A compiler walks into a syntax tree. Ouch."
 
return 1 if goldbachs_conjecture_is_true() else 2
 
return 2 - int(goldbachs_conjecture_is_true())
 
that's how the AI uprising starts, just saying
 
00:00 - 18:0018:00 - 00:00

« first day (2665 days earlier)      last day (2282 days later) »