« first day (2651 days earlier)      last day (2301 days later) » 
06:00 - 17:0017:00 - 00:00

6:06 AM
hey guys i'm getting this error when i try to read a file
'utf-8' codec can't decode byte 0xd1 in position 111: invalid continuation byte: UnicodeDecodeError
 
Check what the actual encoding of the file is.
 
i didnt give any
 
The contents of the file is in a different encoding, but while it is read, it is read as UTF-8.
 
oh ok.. i'll check and get back to you
its charset=us-ascii
 
Hi Friends,
I have two dataframes (one with 80 columns and the other with 81 columns)
How do i find which column is extra in the 2nd dataframe
 
6:19 AM
resource = boto3.resource('s3')
my_bucket = resource.Bucket(bucket)
temporary_file = tempfile.NamedTemporaryFile()
my_bucket.download_file(key, temporary_file.name)

with open(temporary_file.name, 'r',encoding='us-ascii') as f:
file_content = f.read()
print(file_content)
temporary_file.close()
 
@AsmitAdgaonkar df2.columns.difference(df1.columns.tolist())
 
6:50 AM
@cᴏʟᴅsᴘᴇᴇᴅ - Thanks :)
 
whats wrong in the above code?
 
@GaneshKumar Please don't flood the chatroom. When someone is willing and ready, they'll step forward to help. Although I'd have to say there's not enough context to understand what you're doing and why it's not working.
 
7:10 AM
@wim Unfortunately, yes, it comes with the territory. A certain other user had been matching them answer for answer in the pandas tag until I stepped in late July and kept poking them with the Andras Hammer of Justice. Things are relatively better now.
Actually, I'd say things are a lot better, following that meta post last year.
 
cbg
Looks like it was a starry night
 
7:26 AM
cbg! Indeed.
 
7:50 AM
Morning cbg
 
Hi Friends,
I have an index in a dataframe which is in the string format ..eg 201701 201702...
However these are essentially Calendar months of 2017 as you can imagine..
How can i change them to appropriate type datetime
 
Cabbage
 
@IljaEverilä Thanks Ilja, Seems i will have to edit the indexes in the first place to something like 2017-01 from the existing 201701 to be able to apply the to_datetime function
 
You could use the format= argument of pandas.to_datetime instead
 
8:01 AM
cbg, @PM2Ring
@AsmitAdgaonkar Err, did you try pd.to_datetime(df.index.astype(str), format='%Y%m')?
 
@JonClements: I just wanted to say you rock, and to thank you for your quick response :D
Nothing that wasn't already evident, but still :D
 
Or lowercase %y, not sure.
@Cerbrus Hello, is this regarding that "thing" from meta?
 
No
Something completely unrelated
I do have a pending flag for that though
 
@GaneshKumar In that case, you have a problem. ASCII is a 7 bit code, so it cannot contain bytes with a numeric value greater than 127 == 0x7F. You need to find out the actual encoding which was used to create that file. There's a good chance that it's the notorious Windows-1252.
 
8:06 AM
I suppose SO frontend devs just refer to Jon Skeet's profile when testing their changes, you know, to check how well it does when the numbers get stretched a lot.
 
@PM2Ring thanks man.. i'll check it out
 
8:39 AM
cbg
 
After-lunch Cabbage :-)
 
cabbage
 
8:54 AM
cbg
 
@ThiefMaster i tried to run your Latex template with Texworks and i got an error:
LaTeX Error: Option clash for package graphicx.
i treid to install this package from Miktex package manager but i didnt find it?
Do you have any advice
 
cbg
why in my result I have only the last one value from list? dpaste.de/ozAZ
ok, key must be unique
 
9:21 AM
@05135125 Why not do
>>> l = [['a', 1, 'example'], ['b', 5, 'example'], ['e', 12, 'example']]
>>> {u[0]: u[1] for u in l}
{'a': 1, 'b': 5, 'e': 12}
 
@AhmyOhlin It's been a few years but iirc i was using this latex distribution (maybe miktex, not sure) which automatically downloads missing packages on windows. So no idea what's wrong if you get missing packages. Your error sounds like some different problem though
 
9:38 AM
Another option is the almost-unreadable dict(zip(*list(*zip(*[zip(*l)]*2)))) :D
 
"almost"
 
I'm sure there must be a way to do that without using that list call, but I can't figure it out.
 
I don't even... Simple error / don't want to reproduce stackoverflow.com/questions/48316956/…
 
Ugh, there's a HNQ about operator chaining of all things and I can't find a suitable dupe...
People ask too yammin' specific questions
 
10:14 AM
ok
now a 3-display setup
 
@Rawing hammered it
 
Thanks for the dv
 
@vaultah I see you weren't too picky about the dupe :p
 
Anything wrong with it?
 
@vaultah which one was that
 
10:23 AM
@AnttiHaapala link
 
Well, one asks specifically about the short-circuiting, and the other one asks specifically whether it's even possible to chain is...
 
it's probably a dupe of something else, if not that
 
Hi
Any Django expert here?
 
All the questions about operator chaining I found were similarly specific. I wish there was one that explained operator chaining in general, so we could close all the other ones as duplicates of that.
 
@MuhammadHannan the room rules: sopython.com/chatroom
 
10:27 AM
@MuhammadHannan No but there are some flask experts here...
 
Need help in Django queryset
I have been searching for solution but unfortunately not able to get any working for me
 
Okay I found a question about the behaviour of "False is False is False"
That's probably as close as a duplicate can get in this case
 
Good find!
 
And a wild +1 appears on one of my old "False is False is False" answer :D
 
10:41 AM
That's the nice thing about answering a question that can be used to hammer other ones
 
user9092892
Hey. Doest someone know how can I allow user upload files to FileField more than 1 file ?
 
Just saw this mesage.
Not a problem now.
i used the below way:
date_index2 = pd.date_range('2017/01', periods=12, freq='M')
res4 = res3_piv.set_index(date_index2)
 
HI Friends, I am dealing with a time series forecasting problem.
I only have 12 data points, and there is no major trend or seasonality patterns.
nor can i make it stationary it seems.
Going by this randomness, I believe expoential smoothing might be a good way to go..
Any thoughts ?
 
10:53 AM
I think that's more a statistics than a python problem
That being said, if your number of datapoints is that low, no method is likely to produce meaningful results
 
11:16 AM
Yes, thats my fear too
No matter how much i massage the data, it may not lead to satisfactory results.
 
cbg
 
cbg
 
12:15 PM
I wonder if this OP is using LPTHW... stackoverflow.com/questions/48320941/…
 
I'm tempted to post "Upgrade to python 3" as an answer here...
 
@PM2Ring dict(zip(*next(zip(*[zip(*l)]*2)))) but that's probably as helpful as an enema for a corpse
 
12:31 PM
@AndrasDeak Well, it works. :) And I guess using next there instead of list is slightly more sensible, although "sensible" is probably not an appropriate adjective to use with code like this. :)
 
hehe, yeah :)
 
hey guys anyone worked with tempfile? in AWS Lambda
temporary_file = tempfile.NamedTemporaryFile()
my_bucket.download_file(key, temporary_file.name)
the downloaded file doesnt have the extension
 
what "the extension"?
 
i am downloading a .gz file
 
I don't know bucket but isn't the second arg of download_file the new name of the file to save as?
 
12:33 PM
@GaneshKumar Is that the standard tempfile module?
 
In which case isn't that just whatever NamedTemporaryFile creates for you? How should it know to create a .gz?
 
i dont know man.. i'm a newbie to python. i'm an iOS Developer
 
I presume iOS-compatible libraries have documentation too
 
what am i doing wrong here?
 
not reading the documentation, probably
Trying to use functions the expected behaviour and arguments of which you're unfamiliar with is like jumping into a helicopter mid-air, when you don't know how to fly a helicopter.
 
12:36 PM
yep. this one is a quick fix given to me by my manager :( today is the first day in python
 
Welcome to python:) Most python libraries have decent documentation.
 
So where did you get that NamedTemporaryFile function from?
 
actually i have a lambda function that can download a file from AWS S3
@PM2Ring i forgot :P
 
This isn't really a python problem IMO... your code creates a temporary file (which has a random name) and you're downloading your archive to that location. Of course it doesn't have a file extension
 
oh ok.. can you guide me
 
12:38 PM
@GaneshKumar Does your code have import tempfile up near the top?
 
garlic
 
@PM2Ring yes it has
 
@GaneshKumar Ok. So read the docs. You can supply a suffix to NamedTemporaryFile docs.python.org/3/library/…
 
@PM2Ring i found it. should i use "gz" or ".gz" ?
 
@GaneshKumar Use ".gz"
 
12:41 PM
@PM2Ring ok thanks man
 
"If suffix is not None, the file name will end with that suffix, otherwise there will be no suffix. mkstemp() does not put a dot between the file name and the suffix; if you need one, put it at the beginning of suffix."
 
@PM2Ring yeah. now i understand
 
@GaneshKumar in case you'll be working with python in the future, I strongly suggest reading the official tutorial.
 
@AndrasDeak yep sure.. i have another task to finish
 
12:58 PM
Garlic goes well in a lot of food
    x
    array([12, 11,  4, 15,  6])

    f = np.lib.stride_tricks.as_strided
    f(df.score.values, shape=(len(x), 3), strides=x.strides * 2)

    array([[        12,         11,          4],
           [        11,          4,         15],
           [         4,         15,          6],
           [        15,          6,          0],
           [         6,          0, 4363491984]])
Can I change something to get NaNs instead of junk?
I'm trying to stride in rolling windows of 3.
 
I know neither numpy nor stride, so this may or may not solve your problem in a useful way:
def NANIfy(arr):
  for ((x, y) for x, y in zip(range(len(arr)), range(len(arr))) if (x+y) >= len(arr)):
    arr[x][y] = NaN
 
Oh... a loop... :(
Ah well, I'll sleep on it.
 
1:20 PM
def NANIfy(arr, seq):
  for x, y in ((x, y) for x in range(len(arr)) for y in range(len(arr[0])) if (x+y) >= len(seq)):
    arr[x][y] = NaN
The same code without the bugs
 
1:31 PM
@ArneRecknagel When doing stuff with Numpy we try to avoid using explicit loops unless there's no other option. Generally, there will be a way to get Numpy to handle the looping for you that runs at compiled speed, which will be a lot faster than a plain Python for loop.
 
@PM2Ring Do you have a good resource to learn numpy?
 
@ArneRecknagel Not really. I just wander randomly through the docs. :)
 
Well, then I hope the official one is good enough =) I have been putting of learning it for way too long now.
 
1:52 PM
This conversation reminds me of every piece of samurai media where the protagonist has just finished some incredible swordplay and a bystander asks them how they too could become a master of the art and the protagonist denies that there's anything special about themselves and/or explains that the Way is not paved with gleaming stones but is rather a meandering path through thorny brambles and not for the faint of heart
 
I really need to work through a Numpy tutorial myself... I'm sure Andras must be sick of me pestering him with my Numpy questions by now. :)
 
Kevin-sensei, Turing-sensei, thank you for your wisdom. I shall not dishonor this dojo room 6.
 
o/
 
@cᴏʟᴅsᴘᴇᴇᴅ I wouldn't think so. Invalid memory access always gives you junk, and NaN is an unlikely piece of junk
if you see those values you're halfway towards a segfault
hmm, unless a copy is created?
I can't seem to be able to trigger one
 
2:10 PM
Has someone numpy working with python 3.7 on ubuntu? I can't find my error message on google.
 
that error message being?
Oh, I got the segfault after exiting python \o/
 
>>> import numpy as np
>>> np.lib.stride_tricks.as_strided(np.arange(3),(3,),(2000000,))[-1] = 0
Segmentation fault
@ArneRecknagel is that from pip install numpy?
 
Me, before reading that link: "Is it going to be some super-arcane C-related error? I bet it's going to be a super-arcane C-related error."
The link: `error: Command "gcc...`
Me: B-)
 
2:13 PM
I guess I should install 3.7 and see :)
I have an alpha version but I can't get venv to work on it
oh, I don't have pip on it, apparently
 
\o cbg
 
cbg
 
"no module named _ctypes"....*sigh*
 
At some point you have to take stock and think "do I really need to do math at C speeds?"
 
2:19 PM
I wrote a C extension for matlab to help a guy in the matlab room last week or so. I'm sorry to say "yes, I really do" :P
although I prefer fortran speeds :P
 
We're in the Darkest Timeline where such luxuries are hard to come by
 
@AndrasDeak Not even with python3.7 -m pip ?
 
that's the only way I tried
can't even import pip from the REPL
I'll try to install a newer alpha
 
Is the upgrade to 3.7 even worth all that trouble? :s
 
not for me
 
2:26 PM
curious on design question: if you need to grab certain data from the database, would you build the sql script (for example) to do all the filtering, or would you load lightly filter data (for example get all the data for this one person) into your programming language to do the filtering. On one hand, the sql script would make your program cleaner, OTOH, filtering in your program would be easier for others to debug and possible fix (in the future or w.e)
personally I like to load it into my program and then filter but I know a co worker who likes to do it the prior option
 
Our policy at HugeCo is to do filtering within the query where possible, since (in theory) the DB can filter out records much faster than the .Net runtime can
 
That is true... too database languages are meant to filter to grab data faster...
 
The problem of "but then how will someone maintain it if they know C# but not sql?" is solved by "you should not have hired someone in the first place if they didn't know all the languages involved in this job"
I suppose this becomes a more difficult problem if you're working on an open-source project and you want to keep the barrier-to-entry low for random wandering contributors. Ain't nobody going to write a PR if they need to know 8 languages to do it
 
@Rawing I wanted dataclasses and am too happy with them to roll back.
 
or the new hire has a personal relationship with an upper say it's their kid, and you have to pick up the slack :\ (I guess by then it's time to move on with another position)
 
2:32 PM
On the gripping hand, in practice my coworkers and I don't need to know much sql since we mostly talk to the database via an ORM, which is perfectly capable of doing sql-level filtering while not requiring us to write anything but C# code
 
I would definitely push the filtering to the database wherever possible - particularly since cutting down the size of that set obviates some of the damage that other devs inflict by doing things like having methods that do joins for string methods.
That may or may not be specific to CurrentCo though ;)
 
At my place they don't care what you do, so I've had to maintain code in sql and in c# so I was curious if other company are the same. turns out, from the little sample size here, sql is the way to go.
We write own own sql commends as a string in c# then pass it to dapper to retrieve the data that gets automatically converted into our classes.... seems weird if you ask me
 
I like my ORMs to 1) abstract away the details of writing queries, and 2) produce results in nice OOPy structures. It sounds like yours does #2 but not #1.
 
OK, I've got 3.7.0a4
 
Same error when I build from source. I am also on 3.7.04a
 
2:44 PM
got pip too, now running pip install numpy
(I'm on debian but that should be close enough)
 
TIL one can have lambdas as dict values
 
dict values can be anything
 
There are a couple of pages in our project where we do filtering after the fact, because the filtering criteria simply isn't something that you can express in sql. YAGNI plays a role here; if you're pretty confident that the table isn't going to grow past 100 rows any time soon, then do it the easy way now, and the efficient way once management tells you it's necessary
 
@Arne can repro your error
 
"Get all users whose name contains an even number of vowels" I can write in Python in 15 seconds, and in SQL in eight hours. Easy choice
 
2:50 PM
@toonarmycaptain Also commonly used in dispatchers, my new favorite trick
 
@AndrasDeak can they be functions also?
 
@AndrasDeak Yam =(
 
@toonarmycaptain lambdas are functions :P
functions are objects, any object can be a dict value
@ArneRecknagel the current numpy master is failing on Travis, but I'm pretty sure pip should pull a stable version. I'll try some earlier versions in a bit
 
Thanks for the help!
 
>>> {'a':3, 1:sum, None:type(sum)}
{1: <built-in function sum>, 'a': 3, None: <class 'builtin_function_or_method'>}
 
2:52 PM
Anything can be a dict value... except for Crashy, the malicious object I just invented that constantly scans the heap and raises an exception if it detects that it's about to be put in a dict
 
never say never in python
 
>>> hello = lambda: print('Hello!')
>>> hello()
Hello!
 
I thought about actually implementing Crashy, but the least ridiculous version (involving stack inspection tricks) would only be able to easily detect d = {1: Crashy()} and not x = Crashy(); d = {1:x}
 
And, values can be any Python object, so yeah, lambdas can be dict values
 
And it's no fun making a snarky counterexample if the other guy can give a countercounterexample where your counterexample doesn't apply any more
4
 
3:00 PM
both 1.14.0 and 1.13.0 fail the same way, @Arne. I'll try current master to see what happens
same thing with numpy master
oh I'm stupid, there was an issue on the mailing list about building numpy on 3.7 (I just ignored it)
@Arne start here
it appears to be a cython version issue
I'll try installing cython beforehand
 
DSM
Morning cabbage for all.
 
cabbage, DSM
 
Morning, DSM.
 
DSM
@PM2Ring: got your message earlier and snorted. :-)
 
:) I appear to be outnumbered on that question. Nobody upvoted my comment:
FWIW, plenty of Python old-timers aren't happy that type annotations have been added to the language. — PM 2Ring 1 hour ago
 
3:09 PM
cbg DSM
 
A recent answer uses lambda x: x<0 as a groupby key function. I'd probably use (0).__gt__, but I guess directly using dunder methods like that isn't popular.
 
Are you still on that question about sorting positive and negative numbers ?
 
@MooingRawr That's the one. I'm still waiting for the OP to let us know if zeroes are their own category, or if they're supposed to be grouped with the other non-negatives.
 
@wim wait how ? I should read it first before asking how but I guess my initial thoughts are how
 
3:11 PM
@wim "Oh that reminds me of those attacks when...oh."
 
@PM2Ring It isn't so much unpopular I think, just a bit convoluted. Kind of like beginners are often confused by "\t".join(seq)
 
@PM2Ring Yeah he wouldn't respond to my question either
 
DSM
I'd use the lambda too. I almost never use the dunders that way. Among other reasons, it would fail on non-integers.
 
@DSM Fair enough, but that's easily fixed: 0.0.__gt__ :)
 
This is what i was experimenting with:
def brancher(choice, name, quantity):
    return {
        'goal': add_goal(name, 6*quantity),
        'behind': add_behind(name, quantity),
        'foul': add_foul(name, quantity),
    }.get(choice)(name, quantity)
And it's not doing what I expect/desire. It is also not working, but that's not necessarily the point.
 
3:16 PM
the concept is called a dispatch dict
 
functools.partial is useful for implementing this kind of thing
 
for instance, ops = {'+': add, '-': sub, '*': mul, '/': truediv} or something to implement the simplest calculator
 
DSM
@toonarmycaptain: you'll need something like partial or lambda: add_goal(name, 6*quantity) to avoid the functions being called when you're building the dict.
 
@toonarmycaptain Do add_goal etc return functions that expect 2 args?
 
@AndrasDeak Kevin'd. After I already called it back here
 
3:17 PM
Oh I just have the thing
@ArneRecknagel oops, sorry :)
 
@PM2Ring Yes.
 
DSM
Oh, if add_goal returns a function, then pay no attention to my comment earlier.
 
wim
partial sucks
 
isn't it more readable than a lambda?
 
wim
>>> square = partial(pow, y=2)
>>> square(5)
# boom
call-time error
I don't like it
kinda belongs in the trash with everything else in functools
 
3:20 PM
making another strike on the wim-doesn't-like-functools table
 
2 days ago, by Andras Deak
badnan badnan badnan badnan functools functools ;)
 
Maybe I don't mean returns. I've got a function add_goal(name, quantity) which at the moment prints that so and so scored a goal, but that's just a demo, my conception would be that (like any defined function) it could print, modify variables etc, unlike lambda which AFAIK can only return a result from an operation?
 
from functools import partial

def add_goal(name, quantity): print(f"add_goal called with values {name} and {quantity}")
def add_behind(name, quantity): print(f"add_behind called with values {name} and {quantity}")
def add_foul(name, quantity): print(f"add_foul called with values {name} and {quantity}")

def brancher(choice, name, quantity):
    return {
        "goal": partial(add_goal, name, 6*quantity),
        "behind": partial(add_behind, name, quantity),
        "foul": partial(add_foul, name, quantity)
 
@toonarmycaptain whatever you do with a lambda you can do with full functions
 
DSM
@toonarmycaptain: that sounds more like it returns nothing, not that it returns a function.
 
3:22 PM
And the functionally identical version that uses lambda rather than partial:
def brancher(choice, name, quantity):
    return {
        "goal": lambda: add_goal(name, 6*quantity),
        "behind": lambda: add_behind(name, quantity),
        "foul": lambda: add_foul(name, quantity)
    }[choice]()
 
I've never been fond of partial. I guess I'd be happier with it if the resulting callables were fast, but they don't appear to be in my (admittedly limited) tests.
 
DSM
I like partial well enough -- I use it not for performance, but for conceptual clarity.
 
wim
I just don't get what the advantage is over writing a def
it's just like another way to do the same thing
 
I appreciate that partial exists since I think of it as a basic element of the functional programming toolbelt, but it's not something I find myself reaching for very often at all
 
I want to say "I'm partial to" either of the options but honestly I don't have a strong opinion
 
3:23 PM
I'd be annoyed at its absence in the same way I'd be annoyed by the absence of reduce, for instance
 
DSM
(36) dsm@winter:~$ grep partial work/**/*.py | grep functools | wc
    120     493   10873
 
wim
If it could detect cases like partial(int, bogus_arg=123) then I would accept it as a friend, but it doesn't even bother to do that
 
DSM
I seem to import it pretty frequently.
 
now reduce that number by the times you only imported reduce
 
welp that radio thing is on my to play list this weekend... now if I can only find my bunny ears
 
3:27 PM
@Kevin Hmm the lambda works, albeit with (choice)() rather than [choice](), why don't I have to pass the variables in: get(choice)(name, quantity)?
 
DSM
I only used reduce 15 times in that same codebase, so I'm definitely partial heavy.
 
The variables are already accessible to the lambdas inside the dict because they were created in a scope where those variables were present
I find it unusual that (choice)() works for you because I would expect some_dict(some_expression)() to crash 100% of the time
 
DSM
Well, we need to be careful about how we talk about accessibility because of the late binding.
 
Yeah my explanation is a real rough sketch at best
 
doesn't "goal": lambda name=name, quantity=quantity: add_goal(name, 6*quantity) solve that (unless they are used in a comprehension condition)?
 
3:32 PM
Is it merely the absence of interleaving commas, or the keyword lambda that tells the dict that the colons aren't separating key/value pairs? There's some fancy parsing trickery at work there.
 
First rep cap in a few months. On a short effortless answer to a HNQ :-[
 
wim
if you're making the dict everytime inside the function you're not getting any advantage with dict dispatch anyway
 
@toonarmycaptain more likely a typo
 
wim
may as well just stop being a princess and use if/elif
 
@ArneRecknagel Yes, it does, because default args are evaluated when the function object is created.
 
3:33 PM
-80 user removed. Ouch
 
I'm copying from a Dan Bader email and was trying to figure out how it works and might be adapted.
 
@toonarmycaptain Parsing is a real complicated topic but the TLDR of my understanding is "the lambda keyword is how Python knows that the next colon isn't a separator character for the dict literal"
 
@Kevin As would I.
 
Re: "it could print, modify variables etc, unlike lambda which AFAIK can only return a result from an operation?". Lambdas can print, in versions of Python that have a print() function. But it's not done very often.
 
@toonarmycaptain oh sorry, I completely misunderstood your message I replied to
 
3:37 PM
Cabbage
 
@toonarmycaptain I half-suspect you're doing some Franken-solution like d = {...}.get; return d(choice)()
 
The main thing you need to know about Python's parser is that it always moves forward. It never goes backward to change some token that it's already figured out.
 
For the record, I don't like using dict.get unless you're prepared to handle the None that might come out of it. doing d.get(x)(whatever) is no better than d[x](whatever) because when x isn't in the dict you're going to crash either way, with a TypeError or a KeyError.
 
wim
@PM2Ring tokenizer
 
All other things being equal I'd prefer the KeyError since the error message is less cryptic
"NoneType object is not callable" reduces my lifespan by fifteen minutes every time I see it in my console
 
3:42 PM
@wim Quite.
 
@Kevin No I was really just playing with that code I pasted, modded from what I linked to.
 
wim
parser comes later
 
@Kevin Does ` }.get(choice, lambda: None)()handle the None` adequately? That's what I copied, but when I tried to mod from lambdas to functions, I deleted it.
 
Yeah, that would prevent a crash in case of a weird choice value.
 
wim
why are you guys helping this guy write this most unpythonic garbage
 
3:46 PM
Why not drop the function?
brancher= {
  "goal": lambda name, quantity: print(f"add_goal called with values {name} and {quantity}"),
  "behind": lambda name, quantity: print(f"add_behind called with values {name} and {quantity}"),
  "foul": lambda name, quantity: print(f"add_foul called with values {name} and {quantity}"),
}
brancher['goal']('Tim', 3)
>> add_goal called with values Tim and 3
 
@Arne I could finally make numpy work on 3.7.0a4. You need cpython master and then numpy master. I also had to pull up a virtualenv, I think I already tried this combination and it failed. This is the first one that worked.
 
In production-quality code I might be inclined to just have an explicit if choice not in d: return None conditional, but if I were dead-set on doing it all in one line, two-argument get would do it
@ArneRecknagel I think toon's actual add_whatever functions can't fit into a lambda because they have assignment statements and such.
 
@AndrasDeak My attempt with cython 0.27 just crashed, so good thing to know that master works at least. Thanks!
 
@ArneRecknagel Mainly because I was just playing with the code as if those functions would do things other than print (I didn't know lambdas could print), such as modify variables, run whatever code one desired etc
 
I see. I'd still drop the function wrapper and just use the dict directly
 
3:49 PM
Ahhh most of my co workers around me seem to be getting sick.. what to do :(
 
DSM
Flee!
 
+1
 
I can't I need want money lol
 
Cultivate a work culture that scorns people that come into work when they're infectious
12
 
Face mask?
Plastic bags for their heads? (Perhaps a very permanent solution to a temporary illness...)
 
3:50 PM
Yeah I need to buy some face mask
 
I'd like to apply the plastic bag option to the incessant whistlers in my open plan office
 
God I don't like open space when it's flu season lol let me hide in my cubical
 
Face masks, I think, are better at preventing you from transmitting a disease, than preventing you from getting it in the first place
So you'd have to buy one for everyone but you
 
I refer you back to my 'bag your co-workers heads' option. I take no responsibility from any visits from HR or the police this may incur.
 
if anything face mask are only good until the bacteria gets into the mask, then you are screwed.... if you are sick you are trying to filter the bacteria from coming out. I agree with Kevin
Plastic bags... is not an option, we are green living here :D
 
3:52 PM
@Kevin Depends on the mask. I had to wear masks in quarantine rooms in hospitals to protect myself.
 
Maybe I can get one of those reusable cloth bags
 
@Withnail Unfortunately suffocated coworkers also make a good breeding ground for disease, so you're in a tough spot either way
 
Hey, now you're just being picky.
 
"But surely somebody would eventually move the co(rpse)workers out behind the dumpsters?" you think. Remember that these are the people that leave casseroles in the break room refrigerator until they're green and fuzzy
 
Kevin... practice what you preach :D Don't take the fun out of people countering your counters
There's a rule in our office where the cleaners throw EVERYTHING out of the fridge, unless it's common sauces like ketchup and cream for the coffee.
 
3:56 PM
@Withnail You need an elliptical reflector. See xkcd.com/368 and xkcd.com/316
 
I was told this rule was put in place because someone left their lunch in the lunch room and then they moved on to a different company, and they only found out because of the stench that was coming out of the fridge some x months later.
 
Yeah, ours gets emptied every Friday evening
Which I feel is a bit harsh on the people who work saturdays, but nm
 
DSM
I think ours is cleaned once a month, but it's pretty well kept.
 
HAH. Yes, I would like the reflector setup. Or to rub them with a cheesegrater. Although I'm also the person who airhorned the person who was giving my leaving speech, so I'm probably up there on the annoying spectrum. 'Probably'.
 
4:11 PM
wonders if one can get a reflector dish into Coachella, or the State of the Union
 
Maybe if you handed out 0.1% of one to 1000 attendees, in the style of Archimedes' heat ray
Getting them all oriented would be real hard though
 
in Lounge<C++>, 12 mins ago, by Loïc Faure-Lacroix
@BartekBanachewicz because native python can only brute force decrypt
 
Python can do any kind of decryption that any other turing-complete language is capable of doing. Whether it can do it in a practical amount of time, is another matter.
Is the implication here that "brute-force decryption" in the context of zip files means "iterating through all possible byte sequences, zipping/encrypting them, and seeing if any of them match the thing we're trying to decrypt/unzip"? Kind of a bogo-decrypt algorithm? We can't discount the possibility that that's what zipfile is actually doing
O(256^N) runtime is good enough if you have a really fast computer
 
4:37 PM
TIL, Do not write queries like this:
select *
from a, b, c, d
where ...
If you need to add another table, it just explodes
 
glances at an ORM or just don't write queries
 
unfortunately with one of my projects at work we don't use ORM
but rewriting the query with explicit joins wasn't difficult
 
Some of the tables here have a hundred columns and the DBAs really really do not like it when our ORM fills their logs with queries like select foo, bar, baz, [96 more column names go here], qux from users where...
"Can't you just do select *?" they ask. That is beyond my power, however. The ORM does as it pleases.
 
This project has handwritten queries like that
 
Hmm I think I misread your anecdote, which means my anecdote isn't really related at all to your anecdote.
 
4:43 PM
I paraphrased the select clause because the moral of the story is to not do from a, b, c, d.
cross products of tables are inefficient
 
^ this, but edited for the ORM thing
 
I got the reference ;-)
@KevinMGranger In the real query, the select clause has like 50 columns explicitly named.
 
How does Doctor Doom toot the Horn Which Must Not Be Tooted with metal lips? :thinking emoji:
 
The answer is simple: he does as he pleases.
 
His metal lips are extremely supple
 
4:45 PM
Oh, you're right, it says "supple metal lips" right here under the Powers and Abilities section of his Wikipedia page
4
 
that deserves an out-of-context star
 
(The boring answer is probably "Doom still has ordinary human lips underneath his metal mask, and his mask's mouth-slot is large enough to accommodate the Doom Horn mouthpiece, although this is not clearly conveyed by the art in that panel")
 
Is there such an instrument that doesn't require vibration of either the lips or a reed? As in, it directs the air to some sort of internal reed at just the right angle?
 
a flute?
 
Indeed, but I don't think that fits the horn in the picture
 
4:58 PM
I don't understand how any wind instrument works so I can easily imagine one that works as you describe.
 
Oh your question is too broad then
 
"What if, instead of operating by this one kind of magic, it operated on this other kind of magic?" yes I see no problems here
 
<insert magic>
wait you have to roll something above 12 to do that... <rolls dice>
 
06:00 - 17:0017:00 - 00:00

« first day (2651 days earlier)      last day (2301 days later) »