« first day (2090 days earlier)      last day (2858 days later) » 

6:00 PM
he clearly has an Excel-Datei
 
Something like that; I'm on the Chromebook and I don't have Python, so that's untested code. It's 4AM here, so I might have made an off-by-one error or two. :)
 
DSM
@idjaw: I don't see how that code is an alternative to something using .strip(). It doesn't do any stripping, does it?
 
@idjaw well you can listcomp it if you don't fear the wrath of the pythonic police:P
 
@DSM doesn't splitlines remove newlines?
hmm..let me check
gah...I made a mistake
thanks for pointing out the obvious there DSM :)
 
map(jobs.add, [line for line in open(filename).read().splitlines() if line])
 
6:02 PM
jobs.add() doesn't work with lists, does it?
 
jobs is a set
 
@PM2Ring clever :)
 
splitlines - "Return a list of the lines in S, breaking at line boundaries. Line breaks are not included in the resulting list unless keepends is given and true"
hmm..wonder why it did not output as I would have expected based on what I read
oh wait...yes...it does work!
:D
@MorganThrapp That is a nice one. Thank you!
 
@AndrasDeak .add isn't a list method. But it is a set method.
 
No problem!
Wait, if jobs is a set, can't you just do set(open(filename).read().splitlines())?
 
6:05 PM
@PM2Ring I meant pasing a list, but anyway Morgan wrote properly what I was going for:)
 
DSM
Wait, are we trying to remove leading and trailing whitespace or not?
 
@DSM You getting confused with the file .readlines method, which always retains the newlines?
 
The main idea with this is to removing leading and trailing whitespace and ignore any empty lines in the file
(I'm reviewing code and trying to suggest an improvement)
 
DSM
@PM2Ring: no, I'm worried about lines like " \n", which I thought about because of the mention of strip. No stripping is going on at the moment.
 
@DSM Ah, rightio. I guess I should take a look at the actual question. :)
 
DSM
6:08 PM
I might do jobs.update(filter(bool, map(str.strip, f))), but my views tend to be in the minority on this one.
 
DSM brings up a valid point I tested " \n" and splitlines does not work as expected in which that empty space is kept when I might not want it.
 
Just out of curiosity, wondering about how many clean images are needed to build a reliable image classifier. Anyone know ballpark? 100's, 1000's, 10,000's?
To clarify, I'm thinking of for one object type. Say, a toaster
 
@clickhere the more that better
 
@DSM why not jobs.update(line.strip() for line in f)?
 
DSM
@WayneWerner: you'll wind up with '' in jobs.
 
6:09 PM
jobs.update(line.strip() for line in f).pop('')
 
or for line in f if line.strip()
which has the unfortunate problem of stripping twice
 
DSM
@MorganThrapp: (1) update returns None (2) pop fails if the value isn't there.. you could use discard, I guess.
 
map(jobs.add, [line for line in open(filename).read().splitlines() if line.strip('\n')])
 
set(map(str.strip, open(filename).read().splitlines())) is still what I would do.
 
jobs.update(job for job in (line.strip() for line in f) if job) seems like it would work, but it's kind of ugly
 
6:11 PM
@DSM Yeah, I don't work with set much. :P
 
All "one liners" I came up with all looked ugly.
 
DSM
I don't think mine is ugly, but then I use filter and map a fair bit in defiance of Guido.
 
the pop option seems like it looks the best
if you can't otherwise prevent "empty" lines in your file
 
@DSM you are referring to this one right: jobs.update(filter(bool, map(str.strip, f)))
 
DSM
@WayneWerner: again, it would need to be discard, something like jobs.update(line.strip() for line in f); jobs.discard("").
 
6:15 PM
or jobs = set(line.strip() for line in f) - set('')
 
Is there a way to do for/else where the else is only run if the for loop ran at least once? I want to reference variables from the for in the else.
 
hmmm... maybe not -_-
 
for a in []:
    pass
else:
    print(a)
Something like that, but without the name error.
 
really appreciate your input on my question guys. Lots to look at here. :)
 
DSM
SOPython ready to review!
 
6:17 PM
you mean you want to run it when the list iteration finishes? @MorganThrapp
 
Yeah.
But if the loop didn't run, I don't want it to run.
 
Ah. jobs = set(line.strip() for line in f) - set(['']). Not sure that it's much better than the filter/map option, though. Or worse.
 
@MorganThrapp try is ugly, right?
 
Yeah, a little.
 
DSM
Is the iterable known to be a sequence?
 
6:20 PM
oh hey, why not
for a in []:
    pass
else:
    if []:
        print(a)
 
I'm trying to get the last value of an object that gets created in the loop, but I only need the last value, not any of the intermediary value.
 
Alternatively...
 
Because the real code is yielding from a generator.
 
@MorganThrapp pre-allocate your object to None?
 
@MorganThrapp What's your for actually iterating over? Can you get its length before the loop starts? Partly ninja'd by DSM
 
6:21 PM
fee_flag = False
document_number = 0
for status in _process_records(database, rates.rates, current_id, previous_id, collection_type,
                               tax_year, fee_name, paths['extract_path'], _parse_files(file_names)):
    yield status
else:
    fee_flag = status.fee_flag
    document_number = status.document_number
That's the real code.
 
thing_I_want = None
for a in bleargh:
    x = do_something()
    thing_I_want = x
 
yeah I meant that ^
 
(or = a, if that's what you're into)
 
Right now, it breaks if there aren't any valid records, so status is never yielded. I could do status = None and then check if it's None, but at that point, I'm not sure it's cleaner than just setting those two each iteration.
 
it can be one thing_I_want=do_something()
 
6:24 PM
I think I'd probably do...
 
Wrap your generator inside enumerate. Then in the else clause you can get the number of records yielded. Or you could set a counter or flag in the for part.
 
for status in _process_records(*args):
    yield status

try:
    fee_flag = status.fee_flag
    document_number = status.document_number
except NameError:
    pass  # because status was never assigned
 
@PM2Ring That could work.
 
or put your default values in the NameError clause
 
DSM
Using NameError this way feels a little off.
 
6:26 PM
Alternatively...
 
Actually, setting status to None before the loop is probably the simplest, cleanest, and fastest.
 
You'd get AttributeError in that case
you'd have to set it to a default status
 
DSM
Presumably you'd replace the else with if status is not None, or something, though.
 
yeah, that would also work
 
Is this Python 3?
 
6:28 PM
Yeah.
3.5.1
 
Ok. Then you should be using yield from instead of a for loop. And you can use my enumerate trick to get the number of records yielded.
 
How would I do that with yield from? I didn't know you could access the yielded value.
 
DSM
@PM2Ring: I don't see how your enumerate trick is going to work. If the iterable is empty, the enumerate index will be undefined, won't it?
 
@MorganThrapp Oops. I forgot you also needed to access status after the loop.
 
Yeah. I'm using yield from in a couple other places, but since I need the yielded object, I have to do for yield, which I don't love.
 
6:32 PM
@DSM Oh yam. So it will. I should just go to sleep. :)
 
and you should soon be awake :P
if it's 5AM :D
 
why do you need the flag and document number? Is there another way you can structure your code to maybe not need it there?
or that way?
 
Nah, unfortunately I need it.
I had them as globals before, but I just moved away from using globals.
 
DSM
Then just set status to some sentinel, probably None, and then branch instead of using the else, and get on with your day, IMHO.
 
Yeah, that's what I'm doing now.
 
6:54 PM
Hmm... Can I initialze a dict such as {1:2} in the dict(**kwargs) way?
wait, I think the problem is my using the kwargs version wrong
I suspect PEBKAC
 
argh that answer
"This is a blatantly off-topic question for SO, so let me answer."
peer pressure in progress
thanks for the backup:P
 
7:11 PM
I upvoted your comment and downvoted the answer, that counts, right? :P
 
yeah, I was being serious
I mostly meant the comment upvotes:D
 
Oh, haha. I wasn't sure.
So, it's kinda dumb and pointless, but I've been really enjoying this site. It's just really pretty.
 
My coworkers installed the APK for Pokemon Go and are already addicted lol
 
It launched worldwide today, right?
 
It's region locked right now. No US / UK I think.
 
7:17 PM
I thought I saw that they were doing all regions today, maybe not.
 
Yeah, it was supposed to be.
 
Oh, I forgot it was made by Niantec. I should give its shot once it's out in the US.
I was never all that big on Pokemon, but I like ARG stuff.
 
It would be cool if it was VR compatible.
 
Can Python decompose a tuple passed to a two-argument function?
 
Example?
 
7:31 PM
@LittleAlien: like function(*tup)?
(which would apply all elements in tup as separate arguments; it tup contains two elements, function() is passed two arguments)
 
yes, it works!
 
@LittleAlien Greetings. I'm glad Martijn's info helped you, but we don't normally star stuff like that in this room.
 
Let me star whatever I like.
 
It's just not really something that's relevant/funny for the rest of the room.
 
@LittleAlien please respect the room culture; when regulars tell you how a room works, there is no need to be rude back.
 
7:40 PM
THe room culture says "upvote if you know what's good for you"!
Upvote if you know what's good for you (c). Why should I care about what you star?
 
@LittleAlien perhaps that message has context you are missing?
@LittleAlien: I suggest you get more familiar with the room culture before wading in on what the room culture is.
 
But seriously, if you know what's good for you, go upvote it :P
 
I'd have to register on meta and that sounds like a lot of work.
 
Just a button :o
 
DSM
7:54 PM
Hey, I registered on Meta.. but then I'm just happy to be mentioned. :-)
 
You're internet famous now.
 
Well let me tell you! 1. Gin. b. Tonic. iii. Voting up that Q.
 
DSM
I'm also taking bets on whether or not this will be implemented. Current odds are 25:1 against.
 
Yeah, as I said to Jon "If you don't ask, it definitely won't occur."
 
8:00 PM
mpthrapp@HAL9000:/mnt/c/Python Workspace/Hempstead$ ls
ls: cannot access Extracts: No such file or directory
Extracts
The *&%( Windows.
C'mon.
C:\Python Workspace\Hempstead>dur
'dur' is not recognized as an internal or external command,
operable program or batch file.
Really, you don't recognize it, it's the sound you make all day!
Grrrr.
Maybe I should finally switch to Linux.
 
I can suggest some good Linux distros. Arch if you want customisation, CentOS if you want stability, but Vista is definitely the best one.
 
recbg
 
anyone using suse
 
I'm in the constant state of moving from ubuntu to proper debian
 
DSM
I just upgraded my notebook the other day from ubuntu 14.04 LTS, and so had a good chance to consider other distros. Finally I decided I'm too old to learn new tricks, and so went to 16 instead.
 
8:11 PM
:)
let's hope it's shuttleworth it
 
pros stands for professional, right? what are cons?
 
I've been really very impressed indeed with Fedora in the ~3 weeks since I switched from Ubuntu (after being with it almost constantly since Warty).
 
@MarkoMackic Nope, it means the things that are good about something.
 
pro et contra <-> for and against
 
ah yeah
 
8:12 PM
Ahhh, that makes sense. I always wondered where it came from.
 
@MarkoMackic Two-value cells.
 
DSM
One advantage to Ubuntu is that it's the distro of choice for a lot of newbies with dumb questions. When it comes to configurations, I have dumb questions too, so I want there to be lots of people asking similar ones.
@ZeroPiraeus: (har(har(har))).
 
@ZeroPiraeus how that makes sense?
:D
 
I also learned recently that sic is not an abbreviation, but is a word in Latin? Greek? something like that.
 
@MorganThrapp latin
 
DSM
8:13 PM
Something like "thus", IIRC.
 
Sic transit gloria mundi = this is how the glory of the world passes
or something
 
In computer programming, cons (/ˈkɒnz/ or /ˈkɒns/) is a fundamental function in most dialects of the Lisp programming language. cons constructs memory objects which hold two values or pointers to values. These objects are referred to as (cons) cells, conses, non-atomic s-expressions ("NATSes"), or (cons) pairs. In Lisp jargon, the expression "to cons x onto y" means to construct a new object with (cons x y). The resulting pair has a left half, referred to as the car (the first element, or content of address register), and a right half (the second element, or content of decrement register), referred...
 
DSM
When I was a kid I thought "sic" was short for "spelling-is-correct", i.e. "the error is not ours", which in retrospect I'm not too ashamed of.
 
:)
sounds reasonable
 
lol. That's fun.
Kids have the best interpretation of things
I used to think Phoebe was pronounced "foe-bee"
 
8:16 PM
One plus for Arch is the Wiki, though
 
my dad thought "Beethoven" was "bee-thov-in"
 
well, pronunciation is an entirely different kettle of fish
 
My favorite was my sister's goof
 
DSM
Look away to do some work and Portugal's up 2.
 
Can't trust the Welsh.
 
DSM
8:19 PM
#liarparadox
 
My one complaint with having office dogs is that being licked on the leg while you're in the middle of focusing something is mildly startling.
 
Is it weird that "Welshman's Brother" sounds like the name of a victorian gadget to me?
 
aaaawwww:)
 
You have office dogs?
 
I want office dogs
 
8:28 PM
You poor fool.
 
We have 3.
 
@MorganThrapp Funny, that's the same problem I have working from home
 
what kind of dogs?
(Fizzy turn away)
 
We need Office Cats.
 
One of them hangs out upstairs all the time, one of them is always downstairs, and the other one goes back and forth.
 
8:28 PM
that would be cool except all the work lost by cats trampling on keyboards
 
@AndrasDeak Uh, I dunno. I know one of them is a pug.
 
@MorganThrapp oh...
Fizzy, you can turn back now
 
One is a big curly something or other, and the other one kinda looks like a greyhound maybe?
I really don't know dogs.
 
Sound like crap dogs.
 
@MorganThrapp Oh I didn't know:P
 
8:29 PM
You should get cats instead.
 
I'd rather have office cats, but you know.
I'm getting a kitten soon!
 
O_O
 
we lost another one
 
Yup! Probably in the next two weeks or so, mid August at the latest
 
What kind? Fluffy? Derpy?
 
8:31 PM
Some fancy kind? Russian Blue? Commonplaced Maine Coon?
 
Norwegian Forest Cat FTW.
 
I have no idea. The GF comes back on the 20th and then we're going to start looking.
 
@Ffisegydd nice
 
She wants a Maine Coon, but I want a single square inch of hair free space.
 
@MorganThrapp so...one of those wrinkly ones
 
8:33 PM
Munchkin Cat mate.
 
@Ffisegydd noooo that's inhumane:D
 
@AndrasDeak Nah, those are terrifying.
 
a cat that can't jump should be put down
 
@Ffisegydd Ooooo, those are super pretty.
 
8:33 PM
LOOK AT THOSE LEGS! LOOK AT DEM!
 
@Ffisegydd Yeah, I want something like that.
 
SO DIDDY!
 
I'm calling PETA.
 
That's what the GF wants.
 
@MorganThrapp From a main coon, there's no such thing as a hair free surface
 
8:34 PM
@WayneWerner From any haired cat.
 
but they're super loving
 
@WayneWerner That's why I don't want one. :P
 
Maybe a Siamese is a bit better...
 
Make sure you get two.
You can't have a single kitten if you both work, they need company.
 
every catty person I know is constantly battling hair
or just drowns in it
 
8:35 PM
GF isn't working at the moment, because she's still in school.
So we should be fine.
 
You're both still away during the day though, surely?
 
DSM
By "school" you meant college or university or trade school or something similar, right?
 
Morgan is 11, remember.
 
Nah, she's there other than classes, which don't start till August.
@Ffisegydd Hey, I'm double that!
 
12?
 
DSM
8:36 PM
2 is twice 1, so he's got you there.
 
@DSM Yeah, this coming semester is her last semester of undergrad.
 
age halved plus seven
12 -> 13
 
Huh, my limit is finally legal.
 
she must be a cougar
 
@AndrasDeak She's got 2 months on me, and always jokes that she's a cougar.
 
8:38 PM
Same here:) Only with 19 days.
 
It's funny, all the men in my family date woman older than them.
 
I keep telling her that she's old, unlike me.
 
I can't think of a single exception in my extended family.
 
FizzyGirl recently had her graduation, now I can't use "Yes but I'm a Doctor" in arguments as effectively.
 
I'm surprised you're letting it stop you.
 
8:40 PM
:D
 
Oh I'm not, it's just not as effective.
"I'm a Doctor too!" is a solid comeback.
 
is she also a philosophical kind of doctor?
 
Yeah
 
DSM
I dated a girl four years older than me in undergrad (she was a grad student), which is my largest gap in that direction to date.
 
Fizzy used "I'm a doctor". It was not very effective.
 
8:41 PM
I can just use "Yes, but I'm Doctorer".
 
FizzyGirl used "Go wash the dishes". It's super effective!
that's how pokemon works, right?
 
Pfft. We've got a dishwasher.
 
The GF is both the smallest and largest age gap I've had in a relationship.
 
DSM
@Ffisegydd: hey, what's the custom over there about calling non-physicians doctor? We had a bunch of people with Ph.Ds, even professors, who insisted on being called "Mister" for some reason when I was in London.
 
@Ffisegydd you can contract it to Docter
 
8:42 PM
Everyone I know who has a PhD would prefer to be called "docter" I think @DSM
I've never known someone to insist on Mister, unless they are a medical consultant in a hospital (specialist). In which case it's customary to address them as "Mister"
But then over here "professor" is a bit different to "professor" in the states I think (but maybe I'm wrong, not sure about Canada)
 
I loved it how scientific spam often addressed me as professor/dr, even as a PhD student
 
Professor here is a sign of seniority, you don't become a "professor" until 15-20 years in academia if you're really, really good, otherwise you stay as a lecturer/senior lecturer/reader and are addressed as "Dr"
I've always gotten the impression, mainly from American TV, that you rock up to teach at a college/uni and you're instantly a Prof.
 
@Ffisegydd same here
it's the highest academic rank
Well, prof. habil. might be higher? I'm not sure if that's another dimension or not.
 
Dunno what prof habil is.
 
DSM
Someone who wrote an Habillitationschrift (sp. almost certainly -- where's poke when you need him?)?
 
8:50 PM
Habilitation (from Latin habilis "fit, proper, skillful") is a post-doctoral qualification at some European and Central Asian, North African, and Latin American universities. It is conferred for a habilitation thesis or inaugural dissertation based on independent scholarship, which was reviewed by and successfully defended before an academic committee in a process similar to that of a doctoral dissertation. In some countries, a habilation degree is a required formal qualification to independently teach and examine a designated subject at the university level. == Prevalence == Habilitation...
yup
although it seems to be a doctoral kind of thing in Hungary?
 
DSM
Habilitationsschrift. I wasn't so far off.
Anyway, I guess the guys at QMUL were just very anti-title, with their mister-ing.
 
viva la revolucion!
or something
it doesn't help that firefox is working its ass off for no reason, lagging on me
 
@Intrepid I've made an organisation on docker for us to store any images we make for Cradle.
Which is hipster speak for "I did the needful"
 
Too broad, would require explaining basics of python Selection in SQLAlchemy not working - Moehre - 2016-07-06 15:45:36Z
 
9:04 PM
Noooooooooooooo my PC has started pre-downloading the WoW: Legion data. Noooooooooooooooooo!
 
pre-downloading?
Is it pitching a tent to queue for the download link?
 
Pre-download (not even the full patch) is 18GB :P
I should cleanse my PC of WoW, or I'll be dragged back in.
 
there would be much wow
 
user4288844
So... I guess this is the room of the saladarians then?
 
9:20 PM
Something like that.
Some strange members of the room use it.
 
user4288844
So you don't enforce it then?
 
No.
 
user4288844
Perhaps you should have a special program which translates all chat messages into the salad language.
 
I'd rather write a special program that electrocutes people remotely when they say "cbg"
 
How about cabbage?
 
DSM
9:23 PM
Don't pay attention to Fizzy on this subject, he's just being Fizzy.
 
Me, I like electricity... so there's that ;)
 
we'd have to call you Zappy
 
Grumble grumble grumble.
 
9:41 PM
cbg
 
cgb @wgwz
 
btw, you totally pointed me in the right direction with using manifest.in last time. thanks again for that :D
@WayneWerner ^
 
Ah, n/p. Yeah, I've had that problem a few times, so when you described what you wanted I was like, "Oh yes, that thing that I've been so confused about many times before" ;)
 
well i've got to run. rbrb for now. just quickly checking in today.
 
adios
 

« first day (2090 days earlier)      last day (2858 days later) »