« first day (2565 days earlier)      last day (2388 days later) » 
01:00 - 20:0020:00 - 00:00

5:18 AM
fades in
I'll probably be going to PyCon Canada again this year. Still haven't done much work with it over the last year, but it's such a fun and science-heavy community/event that it's always a good time.
I haven't been to Montreal in ~10 years so this is a nice excuse.
 
 
2 hours later…
7:48 AM
cbg
 
cbg
 
cbg
 
if you were here, I brought croissants and pains aux chocolats this morning for the 2k milestone
 
@Uriel Cute, although the badger probably wouldn't approve.
And now I want a croissant to go with this coffee..
 
@PM2Ring :)
 
8:22 AM
@AnttiHaapala imo, your answer is better
 
hmm
I didn't mean to plug my answer there... :">
stackoverflow.com/questions/38430277/… is the duplicate better than this?
 
@AnttiHaapala I'll take a look. Give me a minute...
 
8:36 AM
Cbg
 
@AnttiHaapala The accepted answer in the dupe target says "if one or more objects with the same hash code is/are already in the set, these objects are tested for equality with the new object". I think it's important to mention that it happens in that order (first test the hash and then do the equality test if the hash already exists in the set / dict), but I guess Martijn covers that in his answer.
I like the new answers better, but I think the old question is a little better than the new one. However, my overall feeling is that we should make the older question the dupe of the newer one.
@MartijnPieters I guess it's hard for you to give an unbiased opinion on which question should be the dupe target. ;)
 
@PM2Ring yeah, I'm tainted there.
We could ask @JonClements?
 
8:52 AM
Sure.... heads or tails!? :p
 
> sample(c("head", "tails"), 1)
[1] "head"
 
@PM2Ring I have, honestly, one of the most superb croissants I've ever eaten, this morning.
BUt I also require coffee.
CBG
 
@JonClements depends, which ones are covered in Ninja outfit?
 
Umm.... the purple ones?
 
Not that I have a tail, so I don't know how you'd decide on things with a tail...
Aren't they clusmy appendages, always knocking things over?
 
9:03 AM
Yes... that's why it's important to chase it around in a circle to tell it off now and then...
 
Elie Burztein is presenting at FB.
(SHA-1 collisions fame)
 
Thanks @RobertGrant I didn't even notice the broken __hash__ :oops:
 
9:18 AM
:D
What's the point of the two-step equality test? Why can't you just put the tests you'd put in the eq() method as part of the hash calculation?
(Dunder deliberately excluded there because I hate chat formatting sometimes)
 
Just done my first multi-server rolling deployment in NewCo, and no one in the ops team noticed. rubs thighs This is pleasing.
 
Rubs thighs?
(Well done though, that's cool)
What does it involve? Deploy to one, if it worked, keep going?
 
Yeah, deploy to the 'main' system first, if that works go out to the ancillary ones.
 
Do you do stuff like pull servers out of the load balancer during deployment?
 
Fabric controlling docker. Still building the containers on each machine for legacy reasons (which largely defeats the point, to my mind), will deploy my much nicer 'build once, deploy many' version through dockerhub later in the week.
 
9:27 AM
Cool
 
Hello!! I would like someone to help me. I can't find a solution for my problem and I'm afraid I will lose my time trying to resolve it without a good analisys which I'm not able to do :(
 
Not with this version - we get about 5 seconds of downtime and this was our internal tool. Will be adding that on the next iteration - mostly we're deregistering the celery workers and rebuilding, then reregistering them - the main app can be down for a few seconds while we restart for now.
 
@ShilNevado welcome :) Please read the room rules!
 
(Robert, re: rubbing thighs - I think it might be an old Reeves and Mortimer thing - i didn't realise it was that niche a reference. :D )
 
I launch selenium by a celery task which have to be terminated if it takes a lot of time. (task.revoke(terminate=True)) which kills the python script which launch selenium, so selenium browser is not killed, just the parent python script.
@RobertGrant yes but I would like to disscuss a little. Not just make a question. I'm using selenium for scraping web pages with javascript. But I'm facing some problems with this method. I'm afraid that the problem maybe is not selenium, and maybe there is not a better solution for it.
I'm trying to use other scraping system because selenium is too slow, but I'm afraid that I will lose my time. Maybe selenium is good I just need to improve what it's already done. Terminating a task it's a problem, but if I don't, selenium will continue to run and use all the resources of the system
I'm a little loss, I don't know what should I do, fix celery, fix selenium, change tecnology etc.
lost*
 
9:45 AM
Why are you scraping with Selenium? Selenium is a browser driver.
 
well, maybe I don't understand the meaning of "scraping" I need to download form some pages some pdf but not all the request can be done with a simple request call, because I need to fill forms, select from combo boxes etc. and wait till javascript loads to retrieve the page info. I use also other tecnologies, not only selenium, but sometimes the others are not enought.
 
Okay
Why can't you use the site's API? Is what you're doing against its terms and conditions?
 
My manager suggested me to use splash, but I'm afraid I will have problems too with it. I have to learn that tecnology and lua language and I wouldn't like to lose time for nothing. there are not APIs. Yes it's ok, we just download what we can download manually but in automatic. We even have paid for it.
I'm not stealing anything, just automatizing it.
 
If you're allowed to do it and the page you're scraping is built in JS, i'd be more inclined to just work out the calls and get the info directly from their endpoints.
 
^ this
@ShilNevado my question wasn't about stealing (they shouldn't give you access to things that would be considered "stealing"), more about hitting their website hard with load. But if they are happy for you to do that then that's okay.
 
9:55 AM
so if the page is calling /randomsite/stuffIwant/ it'll either have querystrings like ?filter|+matchtype&12345 or you''ll be able to see the headers (including, presumably the front end authorisation tokens, if they have them) in the network tab in your browser
 
If you do what Withnail suggested, then something like Scrapy might work a lot better than Selenium
As Selenium has to fire up a browser and wait instead of just calling the right endpoints
 
long term that's going to be more sustainable than scraping web pages that change their layout all the time.
(relevant: I mostly work with an API that is almost exactly this setup, albeit a bit more convoluted)
On that note, i'll add in - if you're paying for this, just go ahead and ask for the endpoints. Reverse engineering them is a pain (as you're discovering) and they'll change them without telling you (this happened to us literally yesterday - a field we'd been getting a 0-5 range on suddenly started returning None, which broke a bunch of things. :) )
 
@RobertGrant yes, I don't like neither to hit the website, I need it up,i'm not doing many requests. Just what you can do manualy.
@Withnail I don't think they are interested in support this, it's not their work, and yes, they changed. If I want it I have to work for it. Some sites helped us, others not.
 
:D yes, i feel that
You may also be interested in this - import.io
 
@Withnail We are also using scrapy, my teammate uses it. It depends on the situation. Sometimes I willl need to use selenium because I have to 'click' on the webpge ^^ There are many technologies u.u too many choices. I'll read a little about it. Thanks.
 
10:07 AM
But presumably those clicks end up in a GET or POST to an endpoint. Can't you figure out what that looks like and skip all the clicks?
 
@Withnail I don't understand that import.io seems I just use their software to analize data. I don't need it. Well, thanks to all for your answers ^_^
 
Importio will do the scraping for you, even on dynamic webpages.
But yes, ultimately I'd skip all of the web page clicking and go to the endpoints
What's everyone else working on today, then?
 
Heh, just googling and found a Steve Holden response in a forum :)
 
10:41 AM
have you ever used celery signals? I don't understand official tutorial. I tried to used them but it didn't trigger all the signals :( If you know some good tutorial online would you mind to give me a link? I searched for it but found nothing.
 
Dunno, sorry. I'm yet to get into Celery myself.
 
Tbh, I'd roll back. What do you want to do? You can probably cover off the bulk of use cases using regular delay tasks and celerybeat.
They're fairly similar to django signals, if you've used those before.
 
well. I was using revoke terminated=True but it made problems with process still running after it. I read about SIGKILL too but they are monstrous solutions. There is instead the option of trigger a signal and then catch it in the task. I tried using docs.celeryproject.org/en/latest/userguide/signals.html using decorators in task, but task_revoked wasn't catched by the task
others signals like failure were taken. I have never used signals :( that's maybe the problem.
I tried to read documentation, examples etc. but I didn't find a got tutorial to understand the logic
 
Yeah... this really feels like a problem of trying to solve a difficult problem that's two steps removed from your original issue. If you go back to what we were saying earlier, about 'work out the endpoints and use those', then you won't have to run big, complicated celery tasks to drive selenium that time out, that you then have to handle properly by using signals.
You're making your life way more difficult than it needs to be. :)
 
10:58 AM
my original issue is other, they are related in some way, but not necessary. I told you I'm in a mess XD If I fix these signals of celery I can manage not only selenium but all the tasks in a clean way. I need celery, I need its queue management.
I'll now open a ticket stackoverflow asking for a tutorial :P
 
No, don't do that
That's not what SO is for
Might be worth looking at things like EDX or KhanAcademy or other online education providers to find a Celery tutorial
 
I didn't find any u.u
 
headdesk
 
11:36 AM
hi lmao
 
 
1 hour later…
12:37 PM
@PM2Ring the badger (?)
 
Most likely a reference to room regular Wim, who has a badger avatar.
Distinguishing features include: making his disapproval known about things he disapproves of
 
He is quite black and white about things
 
:-P
 
Very... sett in his ways.
 
Hmm, TIL a new word.
 
12:56 PM
morning everyone
 
1:10 PM
What do you mean "morning"? :>
 
Morning, everyone from roughly UTC-2 to UTC-8
 
and different planets
 
And different meanings of the word "morning"
 
@Kevin I like your style. :)
 
We don't have to be inclusive of other planets because they're not on the Internet. Nobody wants to foot the bill for a billion mile long ethernet cable.
 
1:20 PM
Check your doesn't-need-a-billion-mile-cable-to-get-internet privilege, Kevin.
 
... Yep, it's still there.
 
DSM
Tuesday morning cabbage for all.
 
\o cbg :D another one :D
 
cbg-ning
 
1:40 PM
re-cbg
@Uriel Yes, I was referring to Wim. IME, he likes code to be as obvious as possible and disapproves of cute tricks that impact readability. Of course, what's readable partly depends on what you're used to... Last time he chastised me was for using a boolean as an index.
 
that's one of his pet peeves
 
MRO gives up to 2MBs to Mars.
Which means Mars now has better internet than I grew up with.
 
worse ping though
 
I wonder if anyone in the ISS has posted on SO from space. "Fastest way to reboot CO2 scrubbers? [time sensitive]"
10
Closed as off topic, natch, since that's more of a SuperUser question
 
Haha I was out for a meal recently and two of the (non dev) guys said they've used SO before, but they're scared to ask now because their questions get closed
I said well, I know some moderators, and I'll get them banned if they ever cross me
(One of the mods even has an MBA!) runs
strolls back
 
1:52 PM
@RobertGrant Well, not everything that needs to define __eq__ needs to be hashable, so it makes sense to separate those concerns. Of course, if two objects are equal then they probably should have the same hash, but Python doesn't enforce that, since there are situations where it's useful to bend that rule. So we define an object's equality criteria in its __eq__ method, and usually the definition of __hash__ will be consistent with those equality criteria, but it doesn't have to be.
 
DSM
Two equal objects with different hashes? O.o Not sure I've come across a use case for that.
 
@PM2Ring fair point, although surely the thing you're comparing inside the object needs to be hashable?
Maybe it's an overlapping Venn diagram and my brain can't see why
 
what was that thing which wasn't the namedtuple one :P
 
@DSM For reasons that I'm unable to fathom, JSON permits an object to have multiple identical keys. One way to handle that in Python is to create keys that look like strings but are actually custom objects with a hash method that returns the object's id.
 
Multiple same keys is how you do arrays in a URL; perhaps it's a bit like that
 
DSM
1:59 PM
Ehh. I'd just add an extra level of indirection.
 
Here's a brief demo using a set instead of a dict.
class A:
    def __init__(self, s): self.s = s
    def __repr__(self): return self.s
    def __hash__(self): return id(self)
    def __eq__(self, other): self.s == other.s
print({A('a'), A('b'), A('a'), A('a')})
#output
{b, a, a, a}
 
Couldn't you put the id() as part of the hash?
Sorry, I got that backwards :)
 
@RobertGrant Lots of stuff is comparable but not hashable, eg (sane) mutable objects aren't hashable, but you often want to compare them, eg lists.
 
And blurgh I guess it makes sense there
 
@PM2Ring I see that in some code the __eq__. What does it mean?
it means equal
I got thaty
but why that way?
 
2:04 PM
That class I just posted isn't very sensible, but it's legal. ;)
 
Is it inherent to classes?
 
@AndyK it's structural compare; i.e. is the string inside the same
And I guess set() uses hash not eq to test whether or not to add something in
 
DSM
First identity, then hash, then equality, if memory serves.
 
FINE I guess it makes sense
@DSM yes that sounds right
 
2:05 PM
@AndyK A class can define __eq__ (and several other comparison methods) to control what happens when you try to compare instances of the class.
 
In fact that's probably where it all started
 
@PM2Ring ok
I need to read a bit about it
 
Hi all, I am finally taking the step to put into practice OOP coding instead of just procedural. However I thought it might be a good idea to read through the Flask repo to see some code and see if I can understand/play around with it locally on my machine. Question is where do I start, should I start with the tests?
 
Sounds reasonable to me.
 
@RobertGrant Ah, that probably explains it. But I'm still not happy about it.
 
2:11 PM
@Kevin Cool thanks, as I was trying to have a look earlier at the different files and code, but was getting very confused! So do you recommend looking at the tests, and using them, then start to change stuff around?
 
I think the best approach to learning varies from person to person, but one thing that's always valuable is a willingness to try new things. Given that, I think it's most constructive to just dive in in whichever location and manner you thought was best on your first impression
 
Makes sense, I just confused at first looking though as I did not know how stuff linked to each other. But guess will make a start with the tests and see how I get on. Thanks for the help : )
 
(If it's not obvious yet from my hypergeneralized advice, I don't know the first thing about Flask)
 
Well its more just the actual code on the github repo than the actual framework
 
DSM
I don't know if looking at Flask source is necessarily the best place to start working with OOP code, TBH.
 
2:43 PM
@DSM Ok, do you have any recommendations for other repos?
 
OP seems perfectly happy with his injection-prone answer and given that he hasn't supplied an accept after thirty minutes I expect he's not coming back. Don't think we're going to win this one
Not sure why the commenter was acting like the library was a big mystery when it says MySQL right there in the question
 
Yeah. But at least that page is now a little less dangerous to the future readers.
 
Dear future visitors, this is not a place of honor...
 
3:15 PM
I wonder if the kid with the Tkinter Label wrap question will post a MCVE, or just go away thinking "those mean SO people don't want to help me" stackoverflow.com/questions/46913088/…
 
DSM
@mp252: not really, I'm afraid, because my mind doesn't learn by diving into new codebases. I like to read a thematic overview followed up by examples. :-)
 
@DSM this is how I normally learn as well, but everyone keeps saying its a good habit to learn other people's codebase, but I have no idea where to start!
 
I gave that kid my top-shelf A+ psychic debugging attempt. I was confident enough that I was composing a proper answer in Notepad, just waiting for his comment to drop saying "that fixed it!" so I could smugly copy-paste it in
 
Maybe I should follow the old saying "if it aint broke, don't fix it"
 
3:17 PM
I'm still willing to provide non-psychic debugging, but I need, y'know, something to debug.
 
@PM2Ring 'ab'[c>d]?
 
DSM
I think experts can pick up things better than I can just by looking at code, but if I were an expert I wouldn't need to be reviewing the new code in the first place! Anyway, if it's about something fundamental like OOP I definitely think it's worth going the tutorial route.
 
@KevinMGranger Unhelpful without knowing what kind of zombies. Are the dead rising from their graves independently? Is the infection spreading radially from Patient Zero's position? How do their strength of endurance rate, on a scale of "below human baseline due to decay" to "resilient to the point of defying laws of physics"?
 
"Numerous $EMPLOYER associates have reported zombies rising from their graves and entering $EMPLOYER facilities, as well as appearing in neighborhoods where $EMPLOYER-ers live. They could be anywhere -- from the break room to your mailbox. "
"As with any developing threat, $EMPLOYER ISAAC is your source for safety. Emergency response personnel are being dispatched to neutralize the zombies. In the meantime, associates are advised to stay informed by monitoring ISAAC Alerts (like this one) and following the ISAAC Zombie Outbreak Map."
 
@Uriel Yeah, that kind of thing. I can't remember what the exact example was.
@Kevin Dani's now posted some relevant code, but it's certainly not a MCVE, so I think I'll leave it to Bryan & Ethan. I'm sick of spending time adding all the extra stuff needed to make non-MCVE Tkinter code runnable.
 
3:29 PM
Same.
 
DSM
Y'all need to give up earlier like I do. My life is measurably better now.
6
 
My shield of apathy is usually impenetrable but it's hard to maintain when I only need to crap out a dozen more answers to lowest-common-denominator questions before I hit 50k
(My shield of cynicism is as strong as ever, btw)
 
I wouldn't mind getting a silver Tkinter badge, but I'm in no great rush.
 
3:57 PM
Whoops, chided an OP for not defining all of their names, and it turns out that it was a built-in function -_-
In particular, callable.
I could give the lame half-excuse that it wasn't a built-in in Pythons 3.0 and 3.1, but I think I'll just let the comment stand as a monument to my (ignor|arrog)ance
 
:) Yeah, I saw that. And I must confess it took me a few moments to remember it's a built-in. My excuse is that I've rarely used it.
 
I can't immediately come up with a use-case for it where I would not be equally comfortable with simply trying to call the object and letting it crash spectacularly if that isn't supported.
 
That's just LBYL versus EAFP
 
I'm usually pretty gung-ho for LBYL but there's a limit, yknow?
3
 
That question is a classic example that people who think they want to do exec or eval almost always have a XY problem.
 
4:06 PM
IIRC Chase has a... shall we say... Colorful history of asking questions of that kind.
 
DSM
I just realized that I write "an XY problem", because I think in terms of saying "an ecks-why", and not the spelling.
 
XY might be one syllable, as in "xylophone". A XY problem.
 
I mostly write an XY too, but sometimes I make minor typos that escape my notice. ;)
 
DSM
I grant Kevin the Kakraba Award for most clever use of the word "xylophone" in an original sentence.
 
Pronunciation trumps spelling when it comes to deciding on a/an, or else the particle preceding "herb" would be consistent across all regions instead of the mess that we have now
 
Truly, there is nothing new under the sun.
 
DSM
Can you tell I'm putting off some pre-lunch work? ;-)
 
@Kevin I suppose callable could be useful if you're evaluating a stream of operands and operators, like in this RPN code I wrote recently, but with the actual functions in the stream instead of their key strings.
 
4:29 PM
Ok, that's a reasonable use case. One point for callable.
I'm not crazy about heterogeneous lists but that's a problem domain where it makes some sense
 
4:41 PM
morning cabbage
 
@Kevin Me neither; just mixing strings & numbers in a list like that made me a little uncomfortable.
 
@Kevin That's only a mess because people who are wrong complain about that, when they should "Just stand there in your wrongness and be wrong and get used to it."
 
Morning cabbage
I have no clue what to think about github.com/yarrick/pingfs
 
DSM
Wow
 
4:57 PM
Reminds me of qntm.org/transit, whose plot relies on using a transmission medium as a high-capacity storage medium with a very inconvenient interface
 
@WayneWerner Wow
 
*sigh* recbg
 
@WayneWerner Oh dear.
Of course, the idea itself isn't new. The very early machines used delay lines for memory.
It's not often that you get the writer of a Numpy answer complimenting your plain Python answer.
This is really nice. So much to learn — Bharath shetty 23 mins ago
 
well the question didn't have numpy at all
 
True, and I don't like suggesting Numpy in a non-Numpy question, unless the OP makes it clear that they're processing lots of data.
 
DSM
5:21 PM
I've been known to suggest pandas when otherwise they'd just be reimplementing built-in pandas functionality.
 
like read_csv :>
 
DSM
OTOH I think I once implemented a pivot table in pure Python, just for the heck of it.
 
Someone once described that as "cloud storage, where 'the cloud' is a bunch of raindrops you throw back into the sky"
 
5:48 PM
@AndrasDeak There is a csv module in the standard library... Sure, it does have some limitations, eg in Python 2 it doesn't understand Unicode, so if you need Unicode support you have to explicitly encode & decode, and remember to open your files in binary mode, but that's no big deal. But in Python 3 you're supposed to open the CSV files in text mode, so it's tricky writing such code that runs smoothly on both versions.
 
DSM
I once corrected one of the Names (Martelli, I think) when he forgot newline='' in 3..
 
@PM2Ring I know, I was joking about the fact that a lot of people import pandas for the sole purpose of reading in csvs
 
done
 
gracias
 
de nada
 
6:22 PM
Hehehe. I convinced the missus to install firefox dev edition. Now she's happy that it's all so much faster. I persuaded her to install the tab counter add-on..... 864 tabs :|
 
6:54 PM
cbg gents
 
cbg
 
I'm browsing Stack Overflow but I cannot find how to request the desktop site URL from a website
can I do this in Python?
 
there's an interesting debate going on between unittest vs py.test
I honest to yam do not have any arguments for either
it seems to be it's "use what you want, I'm not your real dad"
@wim ^^ You're a big py.test advocate. Could use some of your experience on this.
 
wim
7:17 PM
debate in your office?
 
I shouldn't have used the word debate. It sounds negative.
It's more of a....why should we fully jump in to py.test
(btw...just started a new job..so a whole new world to explore)
 
reasonable and open discourse where everyone involved hopes to shatter the arguments of the other parties
 
I suppose Google or Apple do this asking for desktop site in headers...
I'm gonna try this
 
wim
The best way is to lead by example. Write an app with 100% coverage and beautiful DRY and pythonic test suite.
It's not possible to write beautiful unittest code, because the framework forces you to put everything into classes for no good reason.
 
Yeah. So, I was looking for concrete reasons why py.test should be used over unittest.
Does it really come down to structure, readability and less code to do more?
 
wim
7:24 PM
I think so, yes.
If you setup the fixture code well, then the tests just read like pseudocode even though they're really testing what they say they're actually testing.
The number one thing you don't get in unit test is the dependency injection through fixtures
you can fake it, by using mixins, but it's very ugly, and you gotta be careful with the mro
class MyTest(SetupThisTest, SetupThatTest, SetupTheOther, TestCase):
    ...
 
is the idea also to not use mocks in py.test?
I don't see how it is avoidable if a function calls something and you don't want it to?
 
wim
the mocks are part of the fixtures
 
ok...so you mock within the fixture setup
 
wim
you generally don't need them in the tests themselves
 
works as a charm
 
7:29 PM
got it
Glad I pinged you. Thanks for the info, wim!
Really appreciate it.
 
wim
@pytest.fixture
def my_fixture():
     # setup (mock stuff)
     yield something
     # teardown
 
and this fixture can be seen as the equivalent of setUp() and tearDown()?
so then your test functions get extremely simple and show exactly what it is testing with a simple assert statement
and thus avoiding the camelcase nonsense
 
wim
yep
 
beautiful!
 
wim
the assert statement is another nice thing
 
7:32 PM
yeah I can see the appeal of using that
 
wim
they actually rewrite the ast to do that
 
interesting!
 
wim
so you get contextual diffs on assertions
unittest approach is to have a million different assertThing methods , that are really just assert statements with the context duct-taped on
another really powerful thing with no good parallel is that fixtures can depend on other fixtures. You can't easily get that simplicity and elegance with the guarantees on the order of setup and teardown by using classes.
@pytest.fixture
def my_fixture(fix1, fix2):
    # if you are here, fix1 and  fix2 have already been setup (in that order!)
    # fix1 name here is bound to whatever object fix1 function *yielded*
    # my setup goes here
    yield something
    # my teardown goes here
    # fix2 will be torn down after me
    # fix1 will be torn down after that
 
DSM
+1 fixtures. They're a lot of fun.
 
hmm....I'm not wrapping my head around that multi-fixture thing. I'll definitely have to mess around with it to visualize it better
 
7:43 PM
recbg
 
wim
it's the same pattern as @contextlib.contextmanager decorator
 
oh!
 
wim
setup is __enter__ and teardown is __exit__
 
OK. I see it now.
 
the assert is the best thing in py.test
everything else is just sugar.
but that... is... not!
 
DSM
7:45 PM
You can combine pytest.mark.parametrize with patch and fixtures to make some very clean unit tests.
 
cool. I like mocking to help isolate single purpose testing
 
(that's called "unit-testing")
 
wim
there is also a huge community of plugins that doesn't exist for unittest
 
so, if I can tie that in to my fixtures and that is considered good practice, then this is a great first step.
 
wim
you can get a lot of them via unittest + nose runner, but nose is dead now so ...
 
7:46 PM
anyway the assert is the best.
I was doing a 3-way merge on json documents
 
wim
the assert rewrite is cool, but that's more like unittest implemented that in the stupidest way possible
so it makes doing the "one obvious way" look awesome in comparison
 
DSM
pluginwise I guess I mostly use cov and timeout.
 
so think about an ordinary assert... {...2287 characters...} and {...2287 characters...} are not equal
O'rly
 
wim
ooh I don't know timeout .. github link?
 
DSM
I'd need to google it.
 
I wonder if I should aim for platinum frequent flyer status today :F
been flying every week now
 
DSM
I think so. Some of the tests in my current project can hang.
 
yeah that sounds like it
somewhat unrelated, but I like the retry package when doing some integration tests and I'm waiting for another service that might not quite be ready
 
Pass those tests through the eventually_halts function first
 
wim
@DSM pypi.python.org/pypi/pytest-randomly is cool too. that runs your tests in random order (and printout the seed if a particular ordering causes issue). really great to make sure you're not relying on import ordering anywhere, or accidentally causing mutable state or coupling between tests
 
7:51 PM
^^ that's neat
 
... kevin'd by kevin when I was googling spelling for Entscheidungsproblem
 
:-P
 
lol
 
DSM
@wim: nice.
 
I should do some algorithm development :F
 
wim
7:52 PM
 
I should try my algometer library idea
 
It's hard to call AST rewriting the "one obvious way" to do anything.
 
wim
I meant more like the one obvious way the assert statement should work
 
DSM
Hmm. The implementation is definitely non-obvious, but I have to admit that assert x == y is definitely the obvious way to write the.. aargh kevinned
 
assert is the one obvious way though, unless you're coming from java...
 
wim
7:54 PM
it's not obvious to implement, because assert is a statement and not a function
it arguably should have been made a function at the same time/for the same reasons as print
it still takes the message with a comma, really weird in Python these days
assert x == y, "message"
 
Making assert a function during the version changeover would have been considerably less painful than doing the same thing to print, since ideally it never shows up in production code anyway
 
wim
the reason is that the compiler can strip assert statements this way, but that explanation doesn't really hold any water if you ask me
 
Why not?
 
wim
for one, some people actually use asserts in library code (e.g. argparse, django rest framework)
 
Thus eliciting only a small number of complaints of "oh, now I have to go back and change my codebase that has been stable for N years?"
 
DSM
7:58 PM
I don't think I've ever run a Python program in -O mode except to show that I can.
 
If you made assert a function, people would combine them in various weird ways. And run them inside list comps. :)
 
Also it would be less painful simply because print is a million times more common than assert
 
01:00 - 20:0020:00 - 00:00

« first day (2565 days earlier)      last day (2388 days later) »