« first day (1585 days earlier)      last day (3362 days later) » 

8:00 PM
well it seems frozen ... hit the stop button
 
@AdamSmith Example?
 
actions = {response: (prompt, func), ...}
while True:
    print("\n".join("{}. {}".format(k, v[0]) for k,v in actions.items())
    resp = input(">>")
    actions[resp][1]()
where actions looks like {"1", ("Hit", lambda: actor.hand.append(self.shoe.draw())), ...}
 
I decided to refactor the lambdas into named closures inside the method and return a sentinel on the actions that should break out of the method
 
you must be reallllly bored right now :P ... dont u have real work to do
 
8:03 PM
@JoranBeasley I'm home with a sick 5yo today. Parenthood has its perks :)
 
lol ok ok
I do that sometimes too
 
@Adam and where do you break?
 
oh thatll be fun ill just make it for kicks
 
or otherwise terminate the loop?
 
ctrl+c
:P
 
8:05 PM
class Game(object):
    ...

    def action(self, actor, actors_hand=None):
        actions = ... # you saw this
        while True:
            # some actions should break this loop which will return out of the function
Right now it's
def action(self, actor, actors_hand=None):
        """List of actions for each player, offering user input.
        Make sure to use the actors_hand kwarg for split hands"""

        if actors_hand is None:
            actors_hand = actor.hand

        def hit():
            actors_hand.append(self.shoe.draw())
        def withdraw():
            actor.balance += self.bets[actor] / 2
            return "break"
        def stand():
            return "break"
        def double_down():
            actor.balance -= self.bets[actor]
 
stand
is exit
 
still writing
"break" is my sentinel value
 
double down should exit too
 
realized when I went to write split that I need to do something fancy to handle splitting hands
yeah I don't even have it drawing a card yet :)
 
no you dont .... create 2 new actors
give each one from self.hand or whatever
and destroy the one you have
 
8:08 PM
@JoranBeasley I'll have to think through that one. The actor right now is a Player object that's a little more complicated than a hand
Thinking of refactoring to make a Hand object that each player has a list of
 
then can you just make actor hand a list?
and ifinstance it?
bleh
reading comprehension lose
 
First hack was creating a kwarg that would accept separate hands, but that breaks the Player.hand_value property
maybe instead make Player.hand_value a @staticmethod that takes a list of Card objects and gives you the value
Not sure yet -- still sorting it out
or just a regular method that has an optional argument with some if hand is None: hand = self.hand logic
Meh I think making separate Hands would be the nicer solution.
 
8:30 PM
Ugh getting too complicated to do without unit testing now.
 
8:53 PM
if I have a numpy array, how do I subset to exclude zeros?
in R, say I have an list data i could say data = data[data>0]
is there a way to do that with numpy array?
 
@DataTx - It's the same syntax, actually
 
ok wow that perfect, got it to work @JoeKington
thank you
 
Happy to help!
 
@AdamSmith I am accepting your create blackjack implementation challenge
:P
 
@DataTx Just so you know, there are a few caveats. E.g. data[0 < data < 5] won't work directly. You'll need to do data[(data > 0) & (data < 5)] instead. Similarly, you'll need to use the & operator in place of and.
 
9:05 PM
I believe in you, @JoranBeasley :)
 
9:22 PM
@JoranBeasley I'm taking a break to write unit tests. Should have started with this but I never think the project will be quite as big as it is until I get there :)
 
@davidism see you've been active on github :)
 
cool@JoeKington that helps a lot
 
9:35 PM
cbg @DSM
 
DSM
Late-afternoon-EST cabbage for all.
 
@DSM oh... a quick pandas question (if you don't mind) as I hope ff is relaxing...
 
DSM
Sure.
 
is it okay to just use any type as the index?
so if I'm importing a small table from a DB that has a PK that's a 3 char reference
(kind of thing)
I know I could just try it, but I've closed down all the ssh sessions, and DB connections for a few hours, so don't feel like mocking up data to try it... and I think it's one of those - if you know, you know questions
 
DSM
You can probably create an index with any arbitrary type. For sane behaviour it's going to need to behave like a sane scalar (equality, comparability, etc -- even nan in an index can cause some trouble.)
 
9:42 PM
so fixed length strings technically are okay, but I'd be insane to do so? :p
 
DSM
I dunno, 'cause I've never worked with a "3 char reference", whatever that is. :-) But you can always use an ordinary string as the index and keep a dict to store the relationship.
 
@DSM indeed... I was just pondering if I can remove further indirection is all... not something I have to worry about this week, was just on my - must look at, and an obvious answer of "no" from someone with experience saves me a few hours trying to work it out myself
(plus gotchas...)
 
face palm This is why writing unit tests after code is bad
 
DSM
Makes sense. BTW, I went to a Python interview today and didn't get a single Python question. Not sure if my mad skillz are just so impressive they didn't know what to ask or what. Does mean that refreshing myself on metaclass behaviour was probably not productive. :-)
 
Had a failing test when constructing a deck because I managed to leave 9 out of the list of ranks to itertools.product through
Just spent 20 minutes on it because I was sure I screwed up the instantiation or etc. Nope -- I just can't count to 10.
 
DSM
9:52 PM
@AdamSmith: and this is why we never do anything manually. :-)
 
@DSM I just set up the class attribute wrong. It builds itself, but I can't count to 10. [1,2,3,4, ..., 13] seemed more explicit than range(1,14)
 
DSM
Blek. My cutoff is about 5-- that's about how many things I can type without making a mistake.
 
apparently I can do 12/13
 
DSM
92% is nothing to sneeze at.
 
@DSM ?
 
DSM
10:06 PM
>>> 12/13
0.9230769230769231
 
@DSM if you're responding to me - was responding to the didn't get a single python question
 
DSM
@JonClements: ah. Yeah, we moved pretty quickly onto project details and plans. But I guess when we were hiring the last Java guy, we only asked the less experienced developers to write code, so I shouldn't have been that surprised.
 
well, normally, when I've got for interviews (quite a while back now), there's a video call and a co-ordinated programming task on a shared whiteboard thingy, some technical Q's, then after that, you get invited to an interview which is brief
regards project management/team leading, getting to meet the guys and see the office and stuff
and then I've except 1 - always got a job offer the same day
 
DSM
I doubt anything will come from this anyway; I think what they have in mind in the near term would be the sort of thing I'd hire a contractor for, not a full-timer. Plus I like my current job, so they'd have to toss a lot of zeros at me.
 
errr... I'd take you on for '0'*sys.maxint if you want? :p
 
DSM
10:15 PM
Somehow I'm not sure my skillset would be much use to you. :-)
 
heh i think you prolly went too complicated :P ... it should be easy
 
umm... never noticed this before... pull out the power cable from the laptop using linux using multiple monitors and it restores the display settings to defaults
 
DSM
10:30 PM
Odd.
 
sometimes they're easier on a vertical base, or sometimes horizontal depending on what I'm trying to look at and refer to
but pulling out the power cable from laptop to move it a bit automatically flicks all displays back to horizontal... oh well... not a big deal
Might just be me, but looking at data (spread sheets for instance) is easier side-by-side
 
can you use wget to download a video from the internet?
 
@corvid yes you can
thanks for asking - that'd be $100 for services rendered, k thx
 
if I had to pay for every time the python room helped with one of my inane contextless questions, I'd probably be bankrupt
 
yup - so learning to make them less inane and with context will save you from that!
Ahh... now that's better... moving up and down when monitors are stacked is far more intuitive
 
10:48 PM
Morning cv please circle jerks :P
Sorry couldn't resist ;-)
 
where can i see the meeting's conclusions?
 
> Appreciate you taking time Reut but I prefer to somehow achieve this via the "while" loop
lol
 
Not conclusions/summary, but a transcript.
 
haha... good to see you again @PeeHaa :p
 
:-)
 
11:04 PM
@PeeHaa you'll find a nice discussion on the transcript regarding that :)
 
Yeah I've seen it :P
 
on sopython.com or here? :p
 
@Ffisegydd thanks :)
 
@JonClements I started on HN news.ycombinator.com/item?id=9065707
 
not sure if that's good or bad, but... hi again anyway :p
 
11:10 PM
o/
 
@PeeHaa the decisions we've chosen to implement (for this room and its usage) are available in the transcript linked by @Ffisegydd so... we shall move forward from there
 
s/memebers/members though
 
sighs who else would in their right mind read a 49 page technical spec. before going to bed
and this is just the "summarised" version
 
Sounds like... fun
 
11:29 PM
@JonClements Feel free to quote any particularly racy bits at us ;-)
 
FYI anyone that cares: Peaky Blinders is an amazing TV series.
 
I've heard good things about that.
 
@Ffisegydd First time I have heard about it. Looks decent
 
Just finished Season 2. Very good.
1920s Birmingham gangs.
 
I noticed on netflix there was a "call me saul" - the follow up to "breaking bad" or something?
 
11:36 PM
Kinda-sorta remnds me that Better Call Saul Ep 3 is out.
:-D
It's the prequel.
 
@ZeroPiraeus Is it any good?
 
ahhh
 
Cabbage :-)
 
Sorry people, I was in a terrible mood last night... :(
Puppppppy :-)
 
11:37 PM
@thefourtheye awwww puppy - have a scooby snack!
 
So far, you don't have to have seen BB, but it would probably help. And yes, it's pretty good – I am swayed by liking Bob Odenkirk's performance a great deal, but really enjoying it so far.
 
@JonClements Melons puppy, I slept for three hours and I am just grumpy now :D
is reading the GM transcript
 
@thefourtheye no need to read it now - chill out, get un-grumpy, un-wind, read it later puppy - no rush...
 
There's no getting past it: I crave junk food, and BCS will be the perfect accompaniment ... rbrb foks :-)
 
@Zero no doubt see you in a bit... got another early/late one
 
11:40 PM
Hasta la etc. then ...
 
au revior
 
@JonClements Oh, there was a bug which was reproducible only in production machines, not in our staging. My lead finally figured out that the reqs were reaching the old version of the site. I spent two days straight in it. So, the transcript is actually changing my mood and making it lighter :-)
 
I don't know if I'm just tired but does: "the API will only return three responses status codes of a possible six, of which, you should cater for all possible 11" - make absolutely no cabbaging sense
 
@JonClements lol
@JonClements Maybe the 11 is binary in which case it makes sense
:)
 
umm, skimming to the back page, there's 4 OK codes, 2 "Nominal" codes, 9 "Error Codes"...
sighs
and some of the OK codes might not be OK, so they need to be cached because they might end up nominal or jump straight to error
who the hell wrote this
 
11:53 PM
WTF are you working on? One of those magical quantum APIs?
 
payment gateways stuff
 
yeap magical quantum APIs sounds not that far off
No matter how horrible remember it can never be worse than paypal's documentation
 
well.. this is all server side for my client... so can't get anyway with a nice copy/paste of some code unfortunately
a layer to my client's system and their gateway blah blah
 

« first day (1585 days earlier)      last day (3362 days later) »