« first day (2545 days earlier)      last day (2386 days later) » 
00:00 - 19:0019:00 - 00:00

12:24 AM
What would be the correct delimiter for a CSV file separated by tabs which appear as "/t"?
 
DSM
12:42 AM
It's really the two characters forward-slash and t, not the one character often written as \t?
 
1:21 AM
I'm setting up a supervisord config file and using enviornment values inside of it. The documentation says "[env vars] can be used in the configuration file using the Python string expression syntax %(ENV_X)s. Why the trailing s?
 
DSM
Historical reasons. The "s" means string.
In [64]: "%(something)s" % {"something": 'goes here'}
Out[64]: 'goes here'

In [65]: "%(something)d" % {"something": 19}
Out[65]: '19'
 
ah, so it's just a way of denoting what's inside the parenthesis
 
DSM
Yeah. If you try "d" with a string, it'll fail, for example.
 
ok, thank you
 
DSM
These days it's considered pretty out-of-date, so you seldom see it in the wild any more.
 
2:16 AM
When using a custom logging formatter class, is there is a way to determine the name of the handler the formatter is being applied to? I have two nearly identical formatters, and would like to combine it into a single formatter, but can't figure out how to differentiate which handler is being run from within format()
 
 
1 hour later…
3:45 AM
Hi everyoe
Hi Everyone!!
Is there any django guy here?
 
user3736406
stackoverflow.com/q/46556597/5875610 Can someone answer this?
 
5:29 AM
Is there a way to do a list comprehension for a variable number of attributes in a tuple?
I have this: v for (k,v) in R if k == key
But there are far more attributes in the tuple than just k,v
 
5:47 AM
Morning cbg
 
6:02 AM
pastebin.com/qnhK8zU9 anyone have any idea what write 13 might mean
 
The return value of write?
 
hmm
@IljaEverilä any ideas what this means DEBUG:fuse.log-mixin:<- getxattr '[Errno 95] Operation not supported
 
6:18 AM
The filesystem in question does not support extended attributes, I guess.
 
thanks :) !
 
Is this an appropriate place to ask a question about image processing using python?
Not an official question, more of an "how to approach" kinda thing.
 
The main site is for most purposes the appropriate place, but a "how to" might be badly received as too broad. The room rules state that there's no need to ask if it is ok to ask. Just ask, and if anyone is able to answer, they'll possibly answer.
A "how to" might fly, if you'd include what you've thought up or tried yourself and why you find those approaches lacking. On the other hand there are a ton of image processing QA already, so try searching around a bit.
 
I have an image that looks kinda looks like this:
I'd like to be able to detect just the little protrusion on the 2nd blob from the left.
I tried doing something using a convex hull. Essentially, this: opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/… and tried different solidity cutoffs.
But that didn't really solve the problem because total area/ total convex hull area
is very close to 1, when the protrusion is small and the overall blob is relatively large.
Any ideas how to solve this?
 
6:44 AM
I have a really really shallow understanding of image processing, but this paper would seem to fit the bill. You'd have to shell out some money, though.
 
Uncle Timmy has weighed in on the 'power of 2' advice for socket.recv:
Ya, "power of 2" was a red herring here. A specific socket implementation may or may not favor particular buffer sizes over others, but the real point of that "bug" report resolution was to discourage the poster from trying to use multi-gigabyte buffers. BTW, the value of Win95 was to discover bugs in Python (& Zope). Its threads & sockets were fine, but had radically different pragmatics (like timing) than Unix-y systems of the time. Running stress tests on Win95 uncovered a world of legit bugs! — Tim Peters 4 hours ago
(Cc: @PM2Ring, @FlorianMargaine)
 
7:07 AM
cbg
 
7:33 AM
cbg
 
cbg
 
7:49 AM
@Jonathan we've discussed this before. New idea: look for convexity defects. Protrusionless blobs won't have any big ones. (Sorry for the train wreck)
 
8:02 AM
cbg
 
8:13 AM
 checkStatus = CreatedJobFromAdminWithoutRegisteredUser.objects.filter(user_found=False)
        checkUsers = User.objects.filter(date_joined__range=(dateFrom, datetime.datetime.now()))

        for currentUser in checkUsers:
            for currentStatus in checkStatus:

                if currentUser.email == currentStatus.e_mail:
                    currentStatus.user_found = True
                    currentStatus.save()
                    test = open("jobtestProd.txt", "a")
                    test.write("\n" + "Creating redmine ticket=" +str(currentStatus.ticket_id) + "\\n")
this is a part of my script im running with a cron job, however sometime the value in the database is written but nothing is appended to my text file
 
Flush/close the file? Use a context manager?
 
yeah i am closing the text file later on
i append some more stuff so i dismissed the rest of the code
 
Does it run in one process?
 
hm im not sure... what exactly do you mean?
 
Multiple copies of your program could interfere writing to the same file
I'd probably use a context manager against closing shenanigans
 
8:21 AM
Cabbage!
 
i dont have much experience with this but i dont think so. Basically im just running a cron script at certain time intervals, but the time between each is over 30 minutes
so there should be no interference
im also making a put request, and i log the response to my text file as well
could that be a problem?
but i think that should be a synchronous request
conn = httplib.HTTPSConnection(redmineURL, 443)
                    conn.request("PUT", "/issues/"+ str(currentStatus.ticket_id)+".json", data, header)

                    response = conn.getresponse()
                    response.read()

                    test.write("ticketId" + str(currentStatus.ticket_id) + "!!!!" + str(response.status) + "===" + str(response.reason))
                    test.close()
something like this
 
@Proxy So that test.close() is happening inside the inner for loop? As Andras said, it's probably a good idea to open your file using a with statement, since that will automatically close the file when you exit the with block.
 
yeah bot the open and close are inside the inner loop
 
lol
 
36Kb of markdown source down the drain.
 
I was expecting some low-quality content that didn't even take much time or effort to write... but that's even worse
 
@MartijnPieters maybe some spam...
 
9:22 AM
@AndyK That's way more effort than any spammer has ever put into posting ever before.
And they have real questions on that account too.
 
Honest idiot
@MartijnPieters that's more scary
 
@MartijnPieters Can't argue on that one : |
 
They've seen proper Q&A
 
He just misunderstood, guys! Poor chap.
@Thảo Hoàng Minh - very cool guide, although it's not for SO. Perhaps your own blog or medium.com might be good places for it? — Robert Grant 2 mins ago
 
That's what I said
 
9:24 AM
 
@RobertGrant +1
 
If only SO had some sort of place where you could put documentation
 
9:55 AM
This is just.. wow. youtu.be/lO9d-AJai8Q
7
 
10:09 AM
@RobertGrant Just follow where the sun goes after it sets and you shall find it! :)
 
10:20 AM
@MartijnPieters so.. "power of 2" is completely pointless?
 
10:31 AM
Xin chào @ThảoHoàngMinh - the Stack Overflow is not a place to share full tutorials like this. Instead you can split your post into several questions that are posed as problems that one might encounter when doing this, and then self-answer them. Or as others have pointed out, you can post the full text elsewhere and then answer the related questions here using it as the support material. — Antti Haapala 2 mins ago
 
@FlorianMargaine Well... 7 is supposed to be the most powerful number... so I'm sure power of 2 pales in comparison :)
 
I have 2.5 years experience in PHP and I want to switch to Python
Can some one suggest the best way
 
@KiranReddy start by forgetting you have experience in PHP.
 
@FlorianMargaine not pointless, but implementation dependent. Buffer alignment is really platform dependent.
 
Kevin'd by Martijn. @KiranReddy then, when you're pretty sure you've never programmed anything in PHP then go to the wiki page and find the tutorial/book that interests you the most.
 
10:39 AM
@KiranReddy: take into account that PHP is haphazardly 'designed' (insofar that functionality accumulated over time can be called 'design'). It may have taught you patterns that are anti-patterns in other languages. Keep an open mind and enjoy learning!
 
@KiranReddy I tend to say that PHP just happened, just like all other accidents do.
Next time after you've come up with the question title, before posting the question please take that title and paste it into google, and open the first search result. If it answers your question, then please upvote the question and the best answers and move on. — Antti Haapala 41 secs ago
 
PHP is the language we deserve, but not the one we need right now.
 
@Robert past tense maybe? “deserved”?
Btw. modern PHP done properly is kind of nice.
 
Yeah it's definitely better than it was
 
10:54 AM
I think I’d probably prefer PHP over Java…
 
Nah
Surely Java is faster, at least when the JVM's warmed up?
 
Hack is almost workable. I don't want to throw myself out of the window every time I work with it, at least.
 
@Robert Not talking about performance, just the language
 
Fair enough
 
@AnttiHaapala Sure
 
11:38 AM
@JonClements now this is what I call a five star customer service experience
 
@PeterVaro impressive
@JonClements okay I did that and I don't like where I am now
 
@PeterVaro Hah, amazing
Unsatisfying response, but still nice
 
11:55 AM
yeah, sadly, but I was completely blown away
:)
 
I've had luck with random stuff like that by tweeting producers of shows...
 
12:18 PM
Hey Jon, would you mind doing me a mod favor again? :P
 
> BEFORE YOU POST COMMENTS:
> 1. Yes I know the difference
> 2. Shallow copies should point to same memory address!
huge misunderstanding right there ^
 
I don't understand why he's saying [:] is a shallow copy when it doesn't behave like one when he tests it
 
Closed as dupe because that disclaimer is wrong.
It is a shallow copy
Shallow copy means that only the first layer of the object is copied.
> but it is not aligning with what I was taught a shallow copy was.
*sigh*
 
Sorry, that's probably strict terminology I'm misusing. Just from following his own reasoning, he seems to show in his middle set of tests that [:] behaves like L2 = [*L1], but doesn't seem to follow through on the implications of that with his comment "makes sense; but thats not a shallow copy if I can alter"
 
Both L2 = L1[:] and L2 = [*L1] do the same thing: Create a shallow copy.
 
12:29 PM
The Cabbage Hour!
 
Cabbages do induce Whizzpops
 
@vaultah That link is good too
 
Yeah, I have to admit that the language-agnostic one is a bit confusing
 
Yeah, it is a bit too abstract for Python’s data model
 
@RobertGrant lol
 
12:51 PM
So, OP is using a C++ book…
 
I found my University C++ book a little while ago. It was this:
look at those cute bugs.
 
i have to store google analytics data and build charts on that data like clicks by hour , day, etc. im really confused if i should run a job hourly to get data and store, or just query google analytics everytime, what if the job fails, it will miss data.
 
@idjaw oh wow
 
oh yeah!
 
I like the subtitle
 
12:52 PM
haha yeah.
 
“Introducing Object-Oriented Design with the UML™” – “the UML™”
 
woooooooo
the future is now
 
Now I’m actually checking whether UML was ever a trademark before.
Probably not
 
Wikipedia doesn't have explicit details on it
 
Also when it's closed (thanks to answers)
 
12:58 PM
@poke Yes the semantics of C++ vice Python were in fact confusing me. But why not think about the pointers? Why think with references? Can you elaborate? — datta 4 mins ago
Meeeh, anyone has a link?
 
cabbage all
 
@poke sorry - didn't have tab in view - wassup?
 
cabbage
 
@JonClements Could you check what caused the comments here to be deleted?
 
1:01 PM
Flagged as no longer needed - a mod agreed
 
cabbage davidism
 
uhuh, a bit quick/early, but okay… Thanks!
 
@poke deleted two days ago - were around 2 + 3 days before that
 
1:20 PM
SymPy

How to simplify sympy expression using some additional constraints? For example,

x,y = sy.symbols('x y', real=True)
expr = x**2 + y**2 + 1

and I have a constraint equation `f(x,y) = 0`:

f = x**2 + y**2 - 1

How to simplify `expr` using `f`?
 
Google assumptions
That's probably the right keyword
cbg
 
I saw, but not clear how to use in my case
 
Cabbage Andras
 
@MaksimSurov did you find the documentation of anything assumption-related?
"Couldn't figure it out" is usually insufficient as a start
 
https://stackoverflow.com/users/7123519/sebastian-nielsen
This number: "7123519" is static right? So if I for instance were to give someone this url, it would always work, the link to my profile would always be the same.
 
1:25 PM
Yes
 
Thanks vaultah.
 
\o cbg
 
cbg
 
Now I've ... had ... the datetime of my li-ife
 
1:34 PM
I don't know which song that is so "summer of 69" keeps popping into my head
 
@RobertGrant +1
 
1:50 PM
Fun task if you're < 32 years old: Figure out when your billionth second will be
 
morning cabbage
@MaksimSurov How would you "simplify" by hand?
 
@MarcusAndrews datetime.datetime(Y, M, D, H, M, S) + datetime.timedelta(seconds = 10**9)?
 
@poke p. much, unless datetime neglects leapseconds
 
no idea
 
bonus points if you have the exact time of your birth and not just the day
 
1:55 PM
I was born at 9 or 10 AM sharp
 
But I don’t know my seconds of birth anyway, so I’m fine with being a few seconds off
I was born at 11:46 am.
 
pics or it didn't happen
 
12:30 am here
 
4:10am I think
 
@Code-Apprentice It’s the time on my birth certificate
 
1:57 PM
lol, Germans
 
what?!
You don’t have that?
 
I'm pretty sure I don't, let me see if I have my birth cert. scanned :)
 
Hello! I was just trying out paramiko. Trying to create a file with SFTPClient.open("my.jpeg", "wb"), I'm getting FileNotFoundError. Did some googling, couldn't find anything on creating a new file with paramiko's SFTPClient. Could someone help me with this (and if so, please do)?
 
I don't have my birth certificate handy
 
I don't have it scanned
 
1:59 PM
I don’t have mine anywhere around me either, but I know the time that’s written on it :P
 
@ratskin you should make a minimal example to illustrate what you are trying to do. It should be complete, meaning that anyone can run it without additional errors other than the one you are asking about.
 
@Code-Apprentice Sure, give me a sec
 
Just checked: only year-month-day written on ours, @poke
 
aww :(
 
@AndrasDeak Well, it's definitely not 10am sharp if you were due at 9 is it? :p
That's just being tardy :)
 
2:05 PM
I thought we didn't need parentheses in python :P
(9 or 10 AM) sharp
 
lol
does 9 mean 9 am or 9 pm?
 
nein, it means 9 AM
 
so (9 am or 10 am) sharp
or (9 or 10) am sharp
 
import paramiko
t = paramiko.Transport(("your_sftp_server", 22))
t.connect(username="myuser", password="mypass")
sftp = paramiko.SFTPClient.from_transport(t)

with sftp.open("cat.txt", "wb") as f:
    f.write("I like cooked cat")
 
@poke you're not doing well if your intentions were refuting my German remark :P
 
2:09 PM
BTW: How do I format code? "`" isn't working and neither is spacing
 
Thanks!
 
the original is already pinned and starred ->
 
Yep, new to SO chat, thanks again
Thought it was private star-ing
 
nah, it's a common pool
if you star the original, its counter increments
 
2:12 PM
Not sure how you'd reach that conclusion though, since you probably starred none of those things, and definitely didn't star them multiple times.
 
@ratskin what's the full traceback you get?
 
@JonClements, here's the full traceback:
File "myfile.py", line 1, in myfile
with sftp.open("cat.txt", "wb") as f:
  File "/usr/local/lib/python3.6/site-packages/paramiko/sftp_client.py", line 338, in open
    t, msg = self._request(CMD_OPEN, filename, imode, attrblock)
  File "/usr/local/lib/python3.6/site-packages/paramiko/sftp_client.py", line 774, in _request
    return self._read_response(num)
  File "/usr/local/lib/python3.6/site-packages/paramiko/sftp_client.py", line 826, in _read_response
    self._convert_status(msg)
  File "/usr/local/lib/python3.6/site-packages/paramiko/sftp_client.py", line 855, in _convert_status
 
Have you changed directory that the logged in user has permissions to create a file (probably write access)?
eg... if you just login via ssh and immediately do echo "I like cooked cat" > cat.txt - does it work?
 
Yes. The containing dir has RWE access for the logged in user
Octal 775
Owner is logged in user
 
2:30 PM
Okay... can the sftpclient then read the file you've created?
 
2:44 PM
I think this OP may do a little more research before they post their next question... stackoverflow.com/questions/46567535/…
 
> I've tried bool(r) != bool(A[i]) but it doesnt work.
wooooooooooow
wanna quote Babbage again
context: the original is r^=A[i];
 
Well, at least they understand that XOR is related to !=
BTW, this one looks right up your alley: Numpy + Ising stackoverflow.com/questions/46567801/…
 
not sure why it's getting a delete vote though
(and I bet I know who has cast it)
 
@PM2Ring thanks, will take a look
@JonClements upvoted spoon-feed answer would be enough for me to delvote
 
@JonClements I don't suppose the OP will mind if it's deleted, since they'll get their points back. And the embarrassing evidence of their lack of research will become relatively invisible. ;)
 
2:50 PM
@JonClements hey I guessed right!
 
@PM2Ring way too much code
 
Fair enough.
 
also way too many issues for me to touch that
thanks anyway for the tip :)
 
No worries. I just left the OP a comment. Hopefully they can reduce the duplication & turn it into a MCVE.
 
DSM
Midweek cabbage for all.
 
2:58 PM
cbg
 
Greetings, DSM.
 
DSM
Overcast morning was vaguely depressing, but unexpected bagpipe music while walking to the station cheered me right up.
 
all bagpipe music is unexpected in my world
 
\o cbg It's Wednesday too so 7 pm should cheer you up :D
 
DSM
Depends on how the succeeding periods go. :-)
 
3:00 PM
I need a beer
or even 2 actually
 
also what are your thoughts on us not wanting J.Bat back ?
 
DSM
Mixed. Oops, forgot about about a meeting -- will follow up on Joey B later
 
@AndyK What's wrong bud ? too much work.
 
soz for my random thoughts, the data are way crappy and I haven't got a proper beer for 3 months-ish now
 
Do you drink beer for the taste or the effect?
 
3:02 PM
@MooingRawr the taste
I'm no a big drinker but the bitterness of the taste is ... great
 
@DSM wait... wat? Bag pipe music cheers you up? I know a lift in one company that you'll never want to actually step out of :)
 
@MartijnPieters Just saw this now; that’s really amazing. Wonder how much planning went into that (and whether the song was actually designed for that purpose or if it fit by chance)
 
@JonClements now there's an unconventional choice of elevator music
 
the root in Chinese for bitter is the same as hard work
 
@AndyK so the German word "bitte" means "hard wok"
 
3:04 PM
Mao Zedong used to say "the ones who have never taste bitterness , don't know life"
 
Speaking of Scottish themed elevators... Burnistoun S1E1 - Voice Recognition Elevator
 
@AndrasDeak bitte do not mean please?
 
@AndyK it probably does, but it's also missing an "r" from "bitter", and woks are extensively used in Eastern Asia, so it checks out
 
loool
 
@PM2Ring you Kevin'd me! darn you... :)
 
3:06 PM
@Andras slow clap
 
you ever try bittermelon?
 
Someone should write a cookbook of bizarre Asian recipes. They could call it Wok the fut?
5
 
@MarcusAndrews love that with some beef
 
@Marcus is there not a really some lemon like shaped thing, that's yellow, called a "lemon" for that? :p
 
@PM2Ring excellent
 
3:08 PM
@JonClements Lemons are sour, not bitter. Unless you add quinine.
 
ninja'd by PM
 
Well, when else does one use lemon except in a gin and tonic? :p
 
@PM2Ring wat :D
 
@PM2Ring lemons can be bitter if you add half a lemon into a stir fry...
 
Lemon zest has found its way into all sorts of food and dessert nowadays
 
3:10 PM
Glad my flippancy has lead to debate...
 
@AndrasDeak There's a version with subtitles if you find the accents too heavy. ;)
 
I understand ~50%
 
Let's complicate matters more and throw some miracle berries in here too
I wonder how bittermelon + miracle berries would be? Toss in some lemon too, why not
 
My sister likes to cook her chicken, with half a lemon, literally just cut half a lemon and stick it in a pan or baked it. Always turns out bitter :\
 
@MooingRawr it's the skin
or the white underskin or whatever that is
the flesh is never bitter
 
3:11 PM
Yeah, lemon skin does have some bitterness, but the fleshy part of the fruit doesn't.
 
shrug all i know is, I don't like it :\ lemon juice in it is fine... and I sometime enjoy nom-ing on a slice of lemon, but maybe you are correct about the white underskin
 
try convincing her to peel the lemon first
 
@poke a lot of planning and rehearsing; note how the lighting is adjusted for every loop too! The song was probably just suitable, loads of songs lend themselves to looping. It's a little harder to get it to work with only addition, but with a little creativity..
 
just try the tip, see how it feels
 
is that your best tip ?
 
3:12 PM
I understand this is a 'loop version' of their new song, so, go find the actual song and compare.
 
for the time being :D
I'm not much of a gastrowizard
 
Look up Jarle Bernhoft on Youtube for some amazing looping examples.
 
@MartijnPieters @Martijn Yeah, I just listened to it, it’s a bit different. Still, awesome work. But it generally amazes me how people come up with the individual tracks to put on top when looping
Zoë Keating also does great looping-based songs
 
I never thought there would be so many Zoes that I start confusing them
 
3:16 PM
rbrb folks
 
One of my favourite looped song performances is by Imogen Heap: youtube.com/watch?v=25VGdNU3nrU
 
rbrb, Andy
 
take care Andy.
 
But note she stops and starts loops as needed.
 
3:18 PM
Yeah, I've seen that one before. I'm pretty sure there have been looper discussions in this room before. :-D
 
Discussions keep looping too
 
hah :D
 
loopception
 
Jun 22 '16 at 19:20, by Martijn Pieters
Having found http://www.voicecouncil.com/10-looping-artists-you-need-to-know-about/
haha
 
3:20 PM
:-D
 
I feel like a bad boy today…
 
@davidism dont u love that answer /s :D
 
no
 
@poke what did you do, drink American beer? (don't kill me it's a joke)
 
Primary rep today was from one answer that literally quoted an ebook (that OP was already linking), and one of those super simple C# questions where the proper action would be not to post an answer… >_<
 
4:04 PM
well shame on you then
 
:(
If the C# one didn’t get that many upvotes and an accept, I would have deleted it…
Maybe if I hit the rep cap in a different way…
 
I am bit confused in compilation process of python
Is the entire source code converted to a single code object or byte code before VM starts its work
 
wim
wow, beardyman still around
I remember his beatbox cooking show from something like a decade ago
 
DSM
@JonClements: next time I'm across the pond you'll have to give directions. :-)
@MooingRawr: I'm really grateful for what he's done for the team, but I think it's probably the right call.
 
I personally want him to take a pay cut maybe 5 mill 2 years and mentor the younglings, but hes not going to want to do that. I don't think Josh would sign for under 10 mill 3 years either :\
I'm a bit salty about last night's AL wildcard game :\
 
4:18 PM
One more vote on that question.
 
DSM
@MooingRawr: I'm in the "if you've got a killer bullpen, USE IT" camp. Not a fan of the guys in pinstripes, so I was conflicted, but I liked Girardi's boldness.
 
I didn't know that the Python interpreter could do branch prediction... stackoverflow.com/a/46569680/4014959
 
@DSM "not that left - the other left!" :)
 
4:33 PM
@PawanSharma Yes, the whole module is compiled to byte code before the virtual machine starts executing the byte code. But if there's a compiled version on disk that's newer than the Python source, the compilation phase can be skipped.
 
evil.sh #5825: script that touches every .pyc file every second
is there some further checking?
 
but apparently byte code is an attribute of code object ( i.e code_obj.co_code) . So does that mean(in case .pyc file doesn't exist) that first source code is compiled to code object then to byte code ?
 
@AndrasDeak I'm not sure, but I don't think so. What further checking could be done that doesn't involve compiling the source & checking that the .pyc file matches it?
 
hashing the source file?
guess we could try
 
I guess that'd work. Assuming the .pyc file stores the .py files hash. :)
 
4:41 PM
yup
 
Speaking of hashing, the other day someone was trying to implement SHA-1 in pure Python (i.e. without using hashlib), but their code was producing hashes that were 71 bits long instead of 160 bits. Sadly, they wouldn't post a MCVE, so Joncle closed it. But I got inspired... An implementation of SHA-1 in pure Python 3
 
stackoverflow.com/q/46569757 "typo" (package isn't installed in env)
 
@PawanSharma Sorry, I'm a bit hazy on the details. The docs say "Code objects are a low-level detail of the CPython implementation. Each one represents a chunk of executable code that hasn’t yet been bound into a function".
I was kinda surprised that I couldn't find a Python version of SHA-1. Sure, it's not very fast, and bit-twiddling in Python can get messy, especially if you're trying to get whatever speed you can from it, but still... Actually, I did find one implementation, but it was in Python 2.4.
 
wim
4:57 PM
Why would anyone want a python implementation of sha1?
 
Hello
 
wim
you already have a C implementation in python std libs, no?
 
@wim it doesn't have to be practical, does it
 
but it should fit on one line
 
wim
huh, I never new bytestrings had a hex method
which python version did that appear?
 
5:02 PM
3.5
 
@wim No idea. Although occasionally people want pure Python implementations of stuff because they're running MicroPython on an embedded system, so they're limited in what DLLs they can put on the system. IIRC, that OP was just doing it as an exercise to learn about crypto hashing.
Python has a reputation for being executable pseudocode, although I admit that bit-twiddling in Python is often not particularly clear, due to the need for masking so that you can get fixed-size unsigned integer arithmetic from Python's arbitrary precision integers.
@wim I only recently discovered it myself.
@wim Sure. Although that does have some limitations. In particular, it's not pickleable, which can be annoying if you need to hash a huge chunk of data and you need a resumable hashing process. But I figured out a way to do that a few years ago... stackoverflow.com/questions/26838194/…
 
what a day this is
 
wim
oh nice, they added a factory function too
>>> bytes.fromhex('cafef00d')
b'\xca\xfe\xf0\r'
/me slips that one in the ol' toolbelt
 
5:37 PM
 
@vaultah Hammered. And now self-deleted.
 
 
1 hour later…
6:51 PM
-8
Q: Python: Is it possible to call a function from a method?

Filled98Maybe my question is stupid, but Im wondering if it’s possible to call a function defined outside a class from a method inside a class? And if it’s possible, how do I do it?

<3
The end program ment to rol a die 30 times and place the results in a list. — H.karim 1 hour ago
 
@DSM did you get a special blue and white cookie from Timmies today? I think I'm going to roll after work to try my luck on the trading cards too :P
 
@AnttiHaapala Mystery solved!
 
00:00 - 19:0019:00 - 00:00

« first day (2545 days earlier)      last day (2386 days later) »