« first day (2110 days earlier)      last day (2854 days later) » 

7:00 PM
@Kevin very very very often because python has these pools of object allocations...
 
I could just set the database name in my class when I create a new connection, but that doesn't account for a potential USE NewDatabase statement.
 
@Kevin Unless the database just doesn't have any SQLAlchemy dialect support, it's going to have all the features. You may just have to dig into the sqlalchemy core to get the feature
 
can you run the sqlalchemy.inspection.inspect(*object*) on the engine instance you're using?
 
Python 2/3 compatibility says that currently there are 2 supported python versions: 2.7 and 3.5. TIL.
 
although i suppose if you're in a different area of the code you may not have that engine instance to hand/imported.
 
7:01 PM
@AnttiHaapala I'm not certain that's true? But maybe I'm wrong and none of the other 3 versions are getting patches?
 
@AnttiHaapala Cool, I thought that might be the case.
 
or were you being sarcastic? :P
 
@WayneWerner sarcastic of course
 
DSM
Midafternoon pause in the chaos cabbage for all.
 
7:06 PM
Ah ha, it's engine.url.database!
 
Hey up DSM. Been a real quiet day round here.
 
DSM
I'm sure we were our usual mild selves.
 
@WayneWerner Always link to the Faq of the site and not the site. The site mods will be looking out for us. :)
Cabbage DSM :)
 
If I'm writing a function that might take a function in to do some special processing, should I leave the default as lambda x: x? Or do None, and check for None in the function body.
 
7:11 PM
@WayneWerner pythons 3.3 and 3.4 have the same status as 2.7
they receive security fixes
 
def do_stuff(things, special_stuff=lambda x: x):
    return normal_stuff(special_stuff(things))

# OR

def do_stuff(things, special_stuff=None):
    if special_stuff is None:
        special_stuff = lambda x: x
    return normal_stuff(special_stuff(things))
 
I like the first one better
 
DSM
@MorganThrapp: huh. I actually don't know what I'd do.
 
ah no, python 2.7 gets bugfixes.
 
@vaultah Yeah, that's my first though. It makes it clearer that special_stuff should be a function pointer.
Or at least something callable.
 
DSM
7:14 PM
I do have kind of a thing about naming lambda functions. As in I don't like it.
 
First one seems fine, provided there's nothing else on the def line that puts cognitive strain on the user. In other words, I like to evenly space out "weird" syntax.
 
And there will be just one lambda object
 
def noop(*args, **kwargs): pass

def do_stuff(things, special_stuff=noop)
    # ... etc.
 
Yeah, that's pretty much exactly the function signature. It's _parse_files(file_names, special_processing=lambda x: x):.
 
too broad/pob (and really no way to salvage) stackoverflow.com/q/38598057/344286
 
DSM
7:14 PM
I was going to propose identity_fn, but noop works too. ;-)
 
@ZeroPiraeus That's interesting too.
 
or even tool/resource :P
 
DSM
@ZeroPiraeus: by the way, your comment before reminded me of an old quote, "The subject who is truly loyal to the Chief Magistrate will neither advise nor submit to arbitrary measures."
 
The issue is that it would be used in a list comp, so it would have to return its argument.
 
Ah, yes, well modify to suit then :-)
 
7:16 PM
Basically, I'm trying to let the user do custom filtering/post processing.
 
Call it pass_through or whatever.
 
Yeah, that would work.
 
@DSM Nice quote, is it from somewhere?
 
DSM
@ZeroPiraeus: it's used as a quote on one of our national dailies' editorial page. From Junius.
 
re cbg
 
@PM2Ring i'm a bad person for teaching kids flask? dafuq.
 
@wgwz I didn't say that!
8 hours ago, by PM 2Ring
@wgwz "just started my next week long class about python! (with middle school age kids) got them into flask the first day XD". davidism will be pleased </sarcasm> You're a bad person, and you should feel bad. :(
 
Yeah, you are a bad person. You should teach them bottle.
 
8 hours ago, by PM 2Ring
@AnttiHaapala Does it really matter which framework you're teaching kids who have one day of Python experience? It's going to end in tears, and horrible SO questions.
 
It's common knowledge that I'm never happy with anything. See my avatar for my current expression.
 
7:28 PM
Unless I just misunderstood you, and these kids already have decent core Python skills, and this was their first day with Flask.
 
Ah, ok. I wasn't sure which way direction the sarcasm tag went.
 
Flask's a fine place to start, in the sense that herding cats is a disaster no matter what direction you try to go. :-)
How's the class going?
 
If the kids are inexperienced, their questions will be bad, and davidism will be displeased having to answer them. If the kids are experienced, they'll become adept question-answerers, and davidism will be displeased having the competition.
 
18 different directions simultaneously?
 
7:29 PM
Solution: hoard all information.
 
I wonder if teaching kids to write their own (simple) webserver would make things better or worse?
 
@wgwz And I'm still not clear on how much Python experience your students have.
 
Teach the kids carpentry instead. The world needs more old-world craftsmanship and fewer apps with names like "bazin.gr"
 
Hmmmmm, PyCharm tries to create old style classes in 3.x. :/
 
people love to see davidism smile , it was the most stared message from the time I joined this chatroom
 
7:31 PM
@Kevin we need all the apps!
 
@MorganThrapp old style? There's only one style in Py3.
 
@MorganThrapp you mean class Foo(object):?
 
@MorganThrapp How is that even possible?
 
@WayneWerner Yeah, that.
Isn't that old style?
 
which is equivalent to class Foo: in Py3
 
user559633
7:32 PM
give a kid a bottle and he'll drink for the night. give a kid a flask and he'll drink whenever he codes.
5
 
it's old new-style ;)
 
user559633
 
@MorganThrapp "Old style class" has a very specific meaning in Python.
 
I just do class Foo: regardless of which version I'm in. Then I weep pitifully if it doesn't work.
But it usually works.
 
@tristan the whole thing?
 
7:33 PM
Inheriting from object is now implicit, so all classes are "new style" in Py3.
 
Ah, gotcha.
 
Just like the u prefix still works, you can still inherit object explicitly for compatibility.
 
user559633
@WayneWerner oh, sorry. i don't know how to link just to it. stackoverflow.com/documentation/proposed/changes/57407 i made a thing about output stream
 
the class is going pretty well. they are beginners (just starting). but like i said, trying to teach them how to use it before they understand it. today i taught them about github and git.
 
I've managed to avoid using Python 2 for any length of time, so I get confused about these things.
 
7:34 PM
btw age range is 10-13
 
I'm sure I've read somewhere that using explicit `class Foo(object): is preferred, since it gives you Py 2-3 compatibility
 
@wgwz is this a summer school?
 
user559633
Interesting. getting an approval on an edit on an existing doc will net you the same points as making a new topic
 
Eh, this will never be used in 2.
 
@tristan I love that i have to scroll a million lines to get to your change
@PM2Ring Yeah, that's what I'd do, if I cared about those lost souls on Python2 was writing code I wanted compatibl
 
7:36 PM
Not without irony, I see that the defcon site is offline. Annoyed to realise to realise there's (obviously) a London group, but that the most relevant talk in a while for me is on tonight. (Data retention and ip Bill).
 
@wgwz Is that around 9th grade? That's when I started
 
I'm still amazed that programming classes exist in primary school now
 
@davidism it's a week long class. it's more like a summer camp, each class is 2 hours
 
2-hours isn't bad for that age group (do your breaks right and you can keep them engaged and still have time to actually lecture/teach)
 
user559633
@JonClements video card just arrived. let me know when you want to get dewormed
 
7:41 PM
@tristan oooo.... how long till it's installed?
 
yeah i let them take some game breaks. they seem pretty into it though.
 
Rhubarb
 
user559633
@JonClements 10 minutes.
 
rbrb @PM2Ring
@tristan I'm not doing much... :)
 
user559633
if it's compatible with my cinema display through an adapter, i'll be available before the top of the hour
 
user559633
7:42 PM
if not, brb computer store run with an excuse to get an 144hz monitor
 
hehe... you want an excuse don't you :)
 
user559633
i'm already way over budget on the PC components
 
It's worth it no doubt!
 
user559633
hah. yeah, might as well meaningfully procrastinate
 
It has to be faster than light
 
7:45 PM
yeah, back to normal SOPython chatting; teaching & upgrading (way over-budget) systems...now someone just needs to bring up something about cooking or drinking
 
user559633
it's 43º in my office. i'm cooking
 
If it's 43! I'd stop cooking - that's just going to add to it :p
 
user559633
nice
 
I think I'm going to buy my pycon ticket tomorrow.
 
Given a list of chunk sizes, what's the easiest way to break a string down into those chunks? Eg, I have a length 20 string that I need to break into sections of 3,3,4,3,3,4. I'd love to do something like [data[position:position+chunk_length] for chunk_length in chunk_lengths], or something similar.
 
7:48 PM
You need to do the sum of the previous chunks as your starting index for each iteration.
 
But can I do that in a list comp?
 
Might be worth pre-processing that into a cumulative list rather than element by element.
 
DSM
Just make an iterator from the original string and draw 3, then 3, then 4, etc.
 
Oh, duh.
 
Forget list comps.
 
7:50 PM
>>> from itertools import islice
>>> text = 'X' * 20
>>> [''.join(islice(it, n)) for n in [3, 3, 4, 3, 3, 4]]
['XXX', 'XXX', 'XXXX', 'XXX', 'XXX', 'XXXX']
 
In [8]: it, chunks = iter(s), [3,3,4,3,3,4]

In [9]: [''.join(next(it) for _ in range(x)) for x in chunks]
 
Beautiful.
 
DSM
Could use accumulate to get the growing indices if you wanted to go that direction, as well.
In [13]: ix = 3,3,4

In [14]: [s[j:j+dj] for j, dj in zip(accumulate(ix),ix)]
Out[14]: ['def', 'abc', 'efab']
Okay, I screwed up the indexing there 'cause I need a 0. But you get the idea.
 
use itertools.cycle for rotating, if it is continuous
 
DSM
Wow, how is it four already? That last hour was not productive at all.
 
7:53 PM
Delightful. My bank recently changed up their website interface, which basically locked everyone out of their accounts
 
I'm kinda... wow - it's almost 9pm... how have the last 14 not been productive at all!
 
Is this unreadable?
def _sbl_converter(sbl):
    return ''.join(
        ''.join(map(str.strip, itertools.islice(sbl, section_size))).rjust(section_size, fillchar='0') for
        section_size in constants.SBL_SECTION_LENGTHS)
 
I wonder what their backlog of calls looks like.
 
yeah
:p
 
Yeah, I was afraid of that. :/
 
7:54 PM
@MorganThrapp it's awkward...
I mean... I could parse it, but it's not very pretty
just make it the 10 lines it should be anyway
 
user559633
that's not the worst looking thing, but a double join on a map and a long line is raises an eyebrow
 
then you'll have some lovely variable names you can use
 
user559633
gaming PC building takes a lot of time, holy wow
 
tla's do not make very descriptive variable names
 
just baked a rhubarb pie
though I probably overcooked it
 
8:01 PM
trying to not comment on ruining sweet things with veggies
 
hey that was way faster than i thought
@AndrasDeak rhubarb crumble is delicious. Then again so is anything with vast quantities of sugar
 
@WayneWerner second.
though, rhubarb with caramelised sugar is good as well
 
mmmmm
 
*caramelised rhubarb should I say
anything with caramel is good
 
fact
 
8:08 PM
@WayneWerner *finished baking. It took 2 hours :[
 
@vaultah most rhubarb deliciousness takes forever. I think it taunts us
 
That sounds about right for baking basically anything?
 
Pretty much. I never really baked anything - just did the pre-made stuff, so I'm consistently surprised when it takes longer than 25-30 minutes in the oven
 
just brown some sugar in a frying pan with butter, then add diced rhubarb.
eat with whipped cream. less than 2 hours
 
Mmm... that's an excellent idea
 
8:14 PM
Lol, I just move out for ~10 mins and I can't see my previous message :D.
I'll read up later. Rhubarb for now
 
rbrb @Bhargav
should've seen what it was like during top drama time:P
 
the room activity graph will be interesting
 
see you bhargav
 
Wtf, sourcetree took away the ability to stage only part of a file.
 
:O really?
 
8:20 PM
@MorganThrapp are you using Hg or git?
 
Won't be updating my version then. Also o/ really pleased to find someone else that uses it :D
 
okay, then that's a huge wtf
 
@Withnail I love sourcetree.
It may only apply to new files.
 
I used sourcetree for a few minutes and then I no longer cared, lol
You should be able to start staging the file, I'm pretty sure
quick, to the command line!
 
8:21 PM
Yeah, I only wanted to stage part of the file, because I created a framework and also created a plugin and I wanted to make those two separate commits.
I'm the only one who touches this code, so I don't care that much, it just bugs me.
 
Yeah, I can totally stage part of a file from the cli, even a new one
git add -p
FWIW
I'm curious what sourcetree does when confronted with command line changes like that
 
It refreshes.
 
will it do the partial commit?
 
I've done stuff in cmd and it reflects in sourcetree.
Probably.
I just pushed everything, but I would assume so.
 
yeah, concur on the 'it refreshes'. It's just reading the .git status file after all.
so any changes that are made that change that, regardless of source, will reflect that, ime
 
8:26 PM
Yeah, that makes sense.
 
That's handy. I wonder if they just moved the partial add feature somewhere
I think I've found that the more I grok different protocols and tools the less I like a GUI
I used to love TheBat email client and others...
now, give me Alpine... and in some cases even that is too much.
Just give me a text file and Vim ;)
 
I think Git's really unintuitive and Bad To Use from the commandline.
Speaking of unintutive
 
Yeah, I feel the same way about git.
 
I only know how to use git from the commandline
I don't think I ever used a GUI for Git
 
The only time I drop into the commandline with git is to do a rebase.
 
user559633
8:31 PM
Same as idjaw. When I try to use git in a gui, my brain freaks out
 
git's UX is poor because you have to understand each higher-level command as a wrapper of shortcuts for the lower level stuff
 
Because I haven't bothered to figure out how to do it in sourcetree yet.
 
@tristan that might have to do with your ADHD
 
Mercurial has TortoiseHg, which is an amazing GUI.
 
user559633
8:32 PM
@AndrasDeak maybe. i haven't medicated for it in years
 
I want to do a join in pandas - so normally I'd do a test, something like: average_output[['Office'].isin(districts['Office'])] - where districts and average_output are dataframes with the same index column. But i've done .groupby['Office'], it spits out a keyerror, since that's now the index. Can't work out what the right terminology is for mapping this back across.
 
@tristan you seem to be doing fine without it, don't you?
 
user559633
@AndrasDeak eh. thinking about going back on it so i'd focus and launch my business
 
w000. I won battle Twisted
 
@tristan Aren't antipsychotics (and other related pills) suboptimal for the user? Like, a lot?
as long as the patient is functional, I mean
(and I don't mean Haskell)
 
8:35 PM
adhd meds aren't antipsychotics, are they?
 
"and other related pills", mostly because I don't know a thing about mental health
 
@Withnail I think they're probably closer to propsychotics
Ritalin, at least, is basically cocaine
 
user559633
@AndrasDeak Oh, yeah, SSRIs or whatever the older version is can seriously wreck you. Most ADHD is treated with dextroamphetamine though
 
ah, interesting
 
user559633
Still not good for renal function though
 
8:40 PM
I never would've thought that crack helps you concentrate
 
user559633
hah, it's not crack. for me, it functioned like snap-to targeting in a video game
 
Ah - that's what I'm trying to ask - how do I compare a key in one dataframe with the index of another dataframe?
 
(I know, it's not crack, it's speed)
 
@Withnail I'm unsure, but Google would be my first choice, probably with site:stackoverflow.com in the query ;)
 
Spoonful of sugar...
 
8:42 PM
@tristan nice
 
Tried that :P
 
user559633
normally, i'm just sort of spraying around, and if i hit the target that i was supposed to be focusing on, hooray! but, largely i have to spent extra time to deal with the fact that i spent half the day targeting the wrong things
 
as long as you have time for important stuff, like twitch
 
(Hence my 'not quite sure what I'm trying to ask' - think my latter question was closer to Proper Wurdz For Subjekt)
 
user559633
for those that "need it", dextroamphetamine will help you be interested in a single thing at a time
 
8:43 PM
@AndrasDeak Antipsychotics vary very widely. The really bad, old (but still often prescribed, at least in the UK) ones just reduce the patient to a zombie-like state in which they aren't functional enough to complain. Modern ones are much, much better.
 
really interesting:)
 
user559633
i'm trying to remember the one i was given to stop smoking with scary side effects
 
Can't imagine why anyone would prescribe any of them for ADHD though.
 
One of my friends wrote this, about that.
 
@Withnail does this help? And this?
if you have both data sets as arrays, that's a start, right?
 
8:45 PM
oh yeah, narcolepsy drugs are basically speed - we have a friend who's on that
she can't watch a movie, because she ends out falling asleep 20 minutes in (or less)
 
user559633
skimmed down: " I was just as productive if I was well rested, healthy, well fed with healthy foods and working on something I cared about."

yeah, that's not at all the way it works if your brain functions like a TV that's slightly out of band
 
...yessss, possibly @AndrasDeak might mean a bit more (continuing) munging.
 
human cognitive functions are an insanely complex thing
 
Fair point, actually. He doesn't have ADHD, so was talking more about non-use-case use of that sort of medication.
 
DSM
Didn't think I'd be arguing about cp1252 VARCHAR or utf-8 NVARCHAR. (No points for guessing which side I came down on.)
 
user559633
8:48 PM
BLOB
 
asciii?
 
user559633
case in point: i totally forgot that i have a gaming PC that i've been excited to get working for half a month
 
DSM
Unusual use of the word "excited", in that case.
 
user559633
call me a bike because i'm excited
 
> It's worth pointing out that Modafinil is a diuretic, so the juice literally was sucked out of me
 
DSM
8:49 PM
Do.. do bikes get excited now? Is that a thing?
 
@AndrasDeak Part of it was I wanted to use the Series method isin - per this answer - to build the new dataset, like this
 
@WayneWerner but he could aim perfectly at anything while peeing
 
user559633
oh man, for those of you that find my video game streams amusing, you're in for a treat: one of my best friends is coming to town and we're going to do some streams. he's currently mocking me for not unlocking all the ships or beating FTL on hard
 
but that doesn't work if it's not a DataFrame/series. meh.
 
user559633
 
8:50 PM
@tristan lol:D
 
@AndrasDeak laser focused
 
@tristan cool!
 
@tristan awww yisss
that game was fun
 
thanks to the unclear article I read about a year ago (or my understanding of it) I had been thinking that modafinil is just another name for ritalin
 
Was more a fan of this:
 
8:52 PM
@Withnail pandas uses numpy under the hood, right?
 
yeah
 
DSM
Aargh, a question I knew the answer to, and I was too slow. :-(
 
user559633
kicksartre: like kickstarter, but what's the point of finishing?
 
DSM
Please tell me you just thought of that now.
 
user559633
8:53 PM
i did. that's how my brain works.
 
@Withnail well does that help?
 
user559633
1-2 make them think you're illiterate and hit em with depressing french writer punch
 
DSM
Whatever you've got, we need to bottle it. And send it to our enemies, to demoralize them.
 
user559633
although, i'd imagine that "depressing french writer punch" is cognac, stale cigarettes, and red wine
 
I thinnnnk so.
Will try in the morning, ta!
Brain's gone fuzzy.
 
8:54 PM
cool:)
good luck
In [734]: np.in1d(np.array([1,6,3,4]),np.array([1,3,5,4]))
Out[734]: array([ True, False,  True,  True], dtype=bool)
bad example; sizes don't have to match of course
 
Hehe. I'm sure you'll know if it doesn't work. ;) Will need to have a read and see if it'll work on array-like things as well as np arrays.
 
(yeah, seems to)
25 days till we hit Budapest. ;)
 
    ar1 : (M,) array_like
        Input array.
:P
array_like, check
(OK, I'm leaving it)
 
booya
rbrb, cheers Andras.
 
8:57 PM
rhubarb:)
 
9:28 PM
hey guys. I used this code to make a graph of most common occurrences in a list:
http://stackoverflow.com/a/19199002/5344673

My list is comprised of only numbers. How can I make the x axis ordered numerically?
 
sort your data...:P
use np.argsort to find the sorting order of x, then use that order to sort x and y together
 
I sort the list but that doesn't work. Do i sort the counter?
 
sort whatever you're trying to plot...
just watch out; the plural of index is indices
 
Apologies
 
9:41 PM
That example creates a dict, you can't sort a dict can you?
 
what would sorting a dict mean? by keys? by insertion time?
 
the dict's .keys() is a list, which can be sorted
 
and then there's OrderedDict
 
but yeah, a vanilla dict has an arbitrary sort order
 
oh. okie dokie
 
9:42 PM
@toshbar aren't you overcomplicating this?
why not use np.histogram for numeric data?
Or maybe even np.bincount
(in case they're integers)
 
because i'm new to python and not sure which things to use for things like this. I'm not too familiar with numpy yet.
I'll look into both of those though. Thank you
 
no problem
numpy is a good choice if you're using it anyway
I might hesitate for a second about this one, if otherwise you wouldn't import it
 
10:43 PM
@AndrasDeak heretic!
 
whaaat?
is it false which I wrote there?:P
oh, it is
in py3 it's dict_keys, not list
 
whaaat?:D
oh, you can also do sorted(mydict)
but I'm anticipating another growl:D
@AnttiHaapala I appreciate you acting as if I knew python, but you can tell me now what you mean instead;)
 
naturally sorted works with any iterable
@AndrasDeak lets put it this way: you still know too much to make a positive contribution to Python documentation
 
lol:D
man, I should've sent toshbar to look at SOD instead
I heard that's a great source of information
 
11:07 PM
This is quite the garbage answer: stackoverflow.com/a/38601186/344286
 
the q isn't much better
 
no, not much. But at least it's a question, I'm not even sure what the answer was trying to be
 

« first day (2110 days earlier)      last day (2854 days later) »