« first day (2340 days earlier)      last day (2612 days later) » 

10:00 PM
See..I totally get mock now, so I just do it. But, the fact it took me a while to get used to it and there is in fact many ways to do it....yes. I agree
Then there's flexmock :)
sigh...flexmock
 
wim
oh, I know how to drive it too, but it's not nice the design
it's like there's mock.patch and it does fucking everything
It should be broken into smaller usable things more specialized. Like freezegun api for datetimes is really nice
 
.....
I wrote my own thing that does what freezegun does
dammit....
this is amazing
I needed to do some "time traveling" tests
this would have helped
 
looks useful
which is saying something, coming from me
 
heheh, the word datetime is used so much in that readme
it just can't be avoided. ever.
 
wim
fucking datetime
 
10:06 PM
@wim that's cool
 
wim
did I import datetime? or did i from datetime import datetime ?
no matter what I guess, i get it wrong :P
 
yeah I'm adding freezegun in to my "don't forget this" list
 
at least it's not pandas.pandas.pandas.pandas :P
I starred it for you guys
 
wim
thx. freezegun kicks butt
@idjaw a guy at my current job had also wrote his own freeze time thing. and when he saw I started using freezegun in commits he was also like ... d'oh ...
 
^^ haha yeah
ugh
it's extra ugh just because it's datetime stuff
 
10:09 PM
@wim subtle trolling. ;)
 
@AnttiHaapala that's ace
 
alright
API design is done
time to get out of here
rbrb friends
 
rhubarb
 
Rbrb!
I wonder if that replication thing supports some nice iron-clad open source clustering tech
 
fffff python2 vs python3 treat the mock value differently
 
10:21 PM
Hmm.
 
that's just python2 mocking you :|
 
Please let me know what problem with my answer caused the downvote, so that I can condier how to address it. — Zero Piraeus 28 secs ago
Literally downvoted within seconds of being posted, which I don't think has ever happened to me before.
 
Sorry. I'm seeing if my new powers vanish if I go back below 5k
 
possibly strategic downvoting by someone who's writing a rival answer
 
Perhaps.
 
10:23 PM
@AndrasDeak I know, haha
 
wim
I don't see anything wrong with the answer
I just downvoted the question, though
"what significance" ... huh?
 
bit opinionated
 
wim
docstring says "Encode the bytes-like object s using Base64 and return a bytes object"
so, dumb question ... why would it randomly encode to text anyway
 
That makes you the second. I theink "why does ..." is a reasonable question; "what significance ..." is awkward phrasing, but I put that down to ESL.
 
python2 habits?
 
10:33 PM
Honestly, I've been surprised by it not returning str myself.
 
wim
it's a reasonable question, when the behaviour is different to what's documented, or at least different to what would be obvious
 
There are arguments either way, really.
 
wim
maybe you got a downvote because
> As an aside, it's worth noting that although base64.b64decode() has accepted unicode since version 3.3
somebody might have misread it as b64encode (which doesn't accept text)
 
they would've left a comment, most likely, and Zero said the downvote was almost instantaneous
 
wim
10:41 PM
+1
I made a minor edit since unicode doesn't really exist in python 3 and people should just stop using that word
....which you just rolled back :)
 
Sorry, rolled it back. Too easy for a beginner to get confused by "ASCII strings"; my instant reaction was that you meant bytes, which made me think you'd iverted what I was saying.
... on reflection, how about str instead of unicode?
 
FWIW I thought that's what wim edited in when he mentioned the edit
 
wim
yes just str would be fine too
but it doesn't accept any old str, it has to be ascii str
so I thought it's better to be more specific
 
maybe elaborate in parentheses...
 
wim
the __doc__ says "ASCII string" FWIW.
OP clearly understands the difference between bytes and text, so ... shrugs
 
10:47 PM
Just tested, and it actually accepts any old rubbish. Just doesn't do anything with it.
 
OP does, I think Zero is worried about future readers
 
wim
@ZeroPiraeus huh??
 
>>> base64.b64decode(b'#$%')
b''
>>> base64.b64decode('#$%')
b''
 
that's ascii
>>> base64.b64decode('#$%')
b''
>>> base64.b64decode('#$%Å‘')
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/base64.py", line 37, in _bytes_from_decode_data
    return s.encode('ascii')
UnicodeEncodeError: 'ascii' codec can't encode character '\u0151' in position 3: ordinal not in range(128)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/base64.py", line 80, in b64decode
 
Heh, so it is. Lotsa misunderstandings here now; interpreted you as meaning "valid base64".
 
wim
10:49 PM
if you can type it easily with your keyboard, it's ASCII :P
 
wellllll :P
 
wim
(geographically dependent...)
 
ÄrÄ™ ¥óu ṡürÄ“?
 
my keyboard ^
 
wim
alright
 
10:50 PM
although I use it with an English qwerty layout by default
 
wim
if I can type it easily with my keyboard, it's ASCII :P
better?
 
that's much better:D
 
wim
Andras Deak, king pedant.
 
If I can hit a letter with my rear end, it's ascii
 
we are pleased
 
wim
10:52 PM
speaking of random downvotes, I just collected one here stackoverflow.com/a/42684939/674039
 
and we were very generous by not pointing out that it should actually be András Deák
 
wim
people just don't like being told not to do what they're trying to do :( :(
 
also, your asker there is also Hungarian
 
ahem
 
but they can't downvote yet
 
10:53 PM
@wim countermanded
 
@RobertGrant I got that :P
 
Oh. Good. Carry on, then.
 
wim
love the eval answer
 
:|
I'm surprised how nobody bashed the answerer yet
 
wim
eval doesn't even do what you need it to do here, but hey, if you rewrite your code then you can use eval !
 
10:56 PM
@AndrasDeak Was just thinking that in the light of recent conversation, someone oughta set that answerer straight. You got there first :-)
 
dunno why people are so fond of dynamic variable names
 
Xzibit has a lot to answer for.
 
black and yellow black and yellow black and yellow black and yellow black and yellow?
I don't actually know who's responsible for that but Xzibit sounds like that;D
 
Didn't Xzibit marry an exhibitionist? She's always showing him off!
 
10:58 PM
I google xzibit and I see "heard you like cars so now you can car while you car" guy
the world is a mysterious place
 
wim
@AndrasDeak a lot of the time, it's because of PHP variable variables
I have worked with a lot of ex-PHP developers who took some time to realise how powerful python is
 
I'm finding it hard not to let cognitive bias tell me that it always comes back to PHP, doesn't it?!
I'm also finding it hard to convince myself that "I'm also finding it hard" doesn't sound very wrong
 
DSM
11:15 PM
I'm about to head out to buy a printer, so this is the wrong time to start anything, but I think the danger of eval is overblown. People like to hyperventilate about it, but even if eval were perfectly "safe", it would still be the wrong play.
 
wim
@idjaw now using pytest-mock in my app. where I was using a monkeypatch.setattr before, the mocker fixture is nicer. thanks!
 
laser or inkjet?
 
Potato!
 
wim
eval isn't bad just because of vulnerabilities.
it's bad just because it's ugly
 
for what it's worth I noted both danger and ensuing crappy code
 
wim
11:17 PM
means the "barrier" between data and code is being muddled
 
DSM
^^ this.
It's the conceptual problem which is ugly.
 
I find security to be partly an excuse with which to convince newbies to forget eval
except in the ominous eval(input(...)) horror scenario
 
DSM
@AndrasDeak: inkjet. I can get a cheap all-in-one inkjet which will serve my needs --
which are incredibly modest -- for less than I'll spend on dinner tomorrow.
 
wim
inkjets are cheap as hell until you need to buy a new ink cartridge
 
yup, I have one like that, it's cheap, and it's great
my HP e-print thingy allegedly uses less ink than usual
I rarely print in colour, so I can't really judge
 
wim
11:19 PM
I had a hilarious situation once when it was cheaper to buy a new printer (with cartridges) than replace the cartridge for existing printer
 
@DSM Have you considered a Buddhist? Make sure you get one that doesn't have DRM'd coloured sand, though.
 
"ink advantage", that's the name
 
wim
thankfully almost never need printers these days, can do most everything with smartphone
 
I mostly bought it as a scanner
but we already had a nice bnw laserjet
 
DSM
@wim: I use printers so seldom that I don't own one.. by the time I need to refill my cartridge I'll probably be retired.
 
11:22 PM
you blissful Westerners and your not having to print anything
 
DSM
@ZeroPiraeus: i got nothin'. Tried a few directions but none of them amounted to anything.. ah, well.
 
wim
sometimes I want to print a sheet of music or something. I just print it at the office .
 
I hear it a lot that people try to take a sheet at work.
 
wim
ticketed events, airlines etc use QR code you can scan on your phone screen here in chicago. if my phone died I think I'd be pretty much screwed for the evening.
 
our train service introduced that feature a while back, ~one year later they actually started to accept devices instead of printed QR codes
most administrative offices work like this: you send them a form, they print it, send it to another office by post, where it gets scanned and archived
unless they ask you to print it in the first place
 
atchoo!
 
wim
@ZeroPiraeus that's the slowest inkjet printer I've ever seen
 
@ZeroPiraeus nice
 
If anyone feels like jumping in here, it seems OP is not yet convinced:
In other words, b64encode() always knows that the output can be represented as a str, why not return a str then? — gardarh 18 mins ago
 
"ask Guido"
 
11:41 PM
Heh :-)
 

« first day (2340 days earlier)      last day (2612 days later) »