« first day (3222 days earlier)      last day (1742 days later) » 
04:00 - 21:0021:00 - 00:00

wim
4:38 AM
 
5:32 AM
@wim thanks!
 
cbg patch
 
@Skyler that's not meant for me, right? let me know if it is.
@wim looks like pynapple is a simple package that checks to see if python is above version 3.6 - and to do that, I just need to import pynapple, right?
 
5:49 AM
patch is my salad word for folks
as a plural it works quite well, e.g.: a patch of developers
 
@Skyler and cbg?
@Skyler also it's my first time seeing "salad word"...I have seen "word salad" but it means something compeltely different...
 
sopython.com/salad
welcome to sopython
 
6:23 AM
btw guys, anybody ever find an easy way to spit out the name of a place from gps coordinates programmatically?
 
@flow2k you actually only need to install it, at which point it will fail for any python <3.6. the requirement is part of the metadata, not the source code.
 
also is there any nice way to just make a virtualenv with the latest python version, like you just specify a url and it downloads and makes the vm
 
6:43 AM
not that I heard of
is there a problem with downloading cpython on building the newest version of it?
 
6:56 AM
@Skyler thanks for pointing me to it!
@Arne I see, thanks!
 
 
2 hours later…
8:51 AM
anyone there?
 
@AndrasDeak oops, i fell asleep in there somewhere. But aye, i should have pointed it out
 
What's your go to library for gui's?
 
hi. There's a lot of options available when it comes to GUIs. Tkinter and pyQT seem like the most popular ones. There's also wxwidgets. I personally however have only seen Tkinter, and very little of it.
I'd say, just pick one. Make sure it has good documentation, and if it does, you're in the clear.
 
See I'm a little strange, I used Tkinter originaly but I have created an app using pygame because of the flexablility
I came to ask if anyone has anything with similar customization but more specialized
 
9:15 AM
cute way to unpack a single-element iterable:
x = [42]
for x in x: pass
 
10:09 AM
That's certainly an interesting use of the word "cute" :)
 
cbg
anyone here from the UK done any python 'certifications' for cv/josb etc?
 
how does referring to an key in a defaultdict makes a key-value pair out of that key?
In [1]: import collections

In [2]: d = collections.defaultdict(str)

In [3]: d
Out[3]: defaultdict(str, {})

In [4]: d[1]
Out[4]: ''

In [5]: d
Out[5]: defaultdict(str, {1: ''})
Here I just referred to the key 1 by doing d[1], and the dictionaries created a key value pair (1: '')
 
'cos that's what a defaultdict is for... if there isn't a value for a key it assigns the default so the [] doesn't fail...
 
That looks like how setdefault behaves, So there's probably something like that used in the source code of defaultdict. If you're looking for a specific answer though, that would be the best place to look.
 
what Jon said, that's the sole purpose of a defaultdict
 
10:20 AM
yeah... it's basically going to be def __getitem__(self, key): return self.setdefault(key, self.default_value)...
 
okay, so referring to an item sets it, since we don't want KeyError
 
What else would you think a defaultdict does?
 
yeah makes sense
 
@DeveshKumarSingh Also consider what happens when you call str() without an arg.
 
If you don't want that behaviour, you can still use the normal dict.get - eg: d.get(1, '') will return you '' but don't actually assign it to the dict
 
10:24 AM
@PM2Ring it gives you an empty string
@JonClements yes that doesn't so what d[1] does
 
Correct. So that's why that defaultdict uses an empty string for the value. Similarly, defaultdict(int) uses 0 for the value.
 
okay, that's more intuitive then the previous answer, thanks
 
from random import choice
from collections import defaultdict

dd = defaultdict(lambda: choice([1, 2, 3]))
for i in range(10):
    dd[i] += 25
slightly convoluted but shows how it just takes a bit of boiler plate code out of dealing with missing keys that has an obvious base value when it is missing...
 
so the default value here is one of 1,2 and 3 ?
 
Essentially, there's a function that's being called whenever you hit a key that was not available. Now, since this function here is taking one of 1,2 and 3, so yes, in this case, that's the defaultvalue.
 
10:35 AM
yeah, when we do defaultdict(str) or defaultdict(list), the constructor of class str or dict is being called
 
that lambda syntax is something i have seen sparingly been used
 
What would be a good resource to understand how functions are executed at a low level?
 
This also helps me understand what's happening
def func():

    value = choice([1,2,3])
    print('Assigning', value)
    return value

dd = defaultdict(lambda:func())

for i in range(10):
    dd[i] += 25
 
you could have just written defaultdict(func) there
 
10:43 AM
yes, that works too, as defaultdict takes a zero argument callable right?
 
@aadibajpai that depends on what you mean by "at a low level"
note that it depends on the interpreter as well
 
then how does defaultdict(lambda: choice([1, 2, 3])) work? Does it somehow wrap whatever choice returns in a function and returns it to setitem or getitem?
 
Question: Is this correct to just close this as typo?
 
@aadibajpai do you mean a blog post, or just something like dis.dis?
 
10:50 AM
@DeveshKumarSingh No, the lambda creates a function that calls and returns choice([1, 2, 3])
 
@DeveshKumarSingh lambda: choice([1, 2, 3])is the same as def foo(): return choice([1, 2, 3])
 
lambda X: Y is a shorthand for def unnamed(X): return Y
 
the lambda is useful because choice([1, 2, 3]) isn't a callable
 
yeah, what I meant by wrapping choice within a function like foo, calling choice and returning the value
 
however, if you wrap lambda x: float(x), you could just have written float - since it is already callable
 
10:51 AM
maybe wrapping is not a good term to use
okay, so it's called default factory
 
@ParitoshSingh Borderline. Better to close is a dupe.
 
Ah yes, that sounds more sensible
 
@PM2Ring I saw that you replied to the code I had and then deleted it?
what is the same observation Paritosh made?
 
@DeveshKumarSingh Yes, it was. I mentioned you had an extra needless level of function calling.
 
@DeveshKumarSingh you need to put it in a lambda or a named function to delay execution of choice([1,2,3])
 
11:06 AM
@ParitoshSingh I know there's good dupe targets for this, but it's hard to find them because Google is biased towards questions and especially question titles, not answers. I found this stackoverflow.com/questions/37619848/… but it's not really close enough IMHO to use as a target.
I'll hammer it with the 2nd one. We can always add better targets if anyone can find one.
 
@MisterMiyagi, @Arne I was looking to know more about what happens under the hood in Python and if things like function execution etc leave a trace
 
"under the hood" as in "what is the interpreter doing"? did you take a look at the CPython source code already?
 
Yeah I looked at the repo, I was thinking if there's a technical document or maybe even some guide or so to it.
 
11:25 AM
I recommend poking around a bit and checking back here
there are several layers to how Python works, and not all of them are obvious
in case of doubt, "what CPython does" is the only law, however
 
Sounds like a good place to start
 
user10984358
If I have an integer (maxSize)that defines the maximum size of a string and a string (txt), is there any way to make sure the contents of the string are always in the center? padded with spaces at either end I tried this so far
 
user10984358
txt='*' # length can be from 0 to anything
maxSize=9 # can be odd or even
curLen=len(txt)
txt.rjust(curLen+(maxSize-curLen)//2,' ').ljust(maxSize,' ')
txt='***'
txt.rjust(curLen+(maxSize-curLen)//2,' ').ljust(maxSize,' ')
 
>>> '***'.center(9)
'   ***   '
 
user10984358
seriously?? i feel so dumb rn
 
user10984358
11:34 AM
i searched on how to pad string with spaces on either side didnt come across that
 
user10984358
is this how one should logout from SO?? i logged in from my work pc and now i cant logout lol
 
user10984358
76
A: How can I log out from Stack Overflow?

Martijn PietersYou can log out of Stack Overflow via the drop-down under the hamburger menu to the right (the one echoing the shape of the Stack Exchange logo): This applies just to the site your are active on. You really want to log out from the OpenID provider, too, as anyone can now use your computer to l...

 
user10984358
i never tried logging out before
 
@TheNamesAlc Hmm? I didn't quite understand that question.
 
user10984358
i had to google how to logout
 
11:43 AM
okay?
 
You're not allowed to... this is Hotel California :)
 
user10984358
it doesnt log me out
 
@TheNamesAlc perhaps you're doing it wrong?
 
user10984358
i just logged out and i entered the url and i am logged in
 
user10984358
so i just close the incognito window?
 
11:44 AM
If it's incognito then what are we even talking about?
those windows should not store and share sessions
 
user10984358
but still, who cares
 
user10984358
i will just close
 
user10984358
if i were to have logged in the normal way (non incognito) that would have been an issue
 
yup
 
12:00 PM
@PM2Ring level up
 
12:12 PM
I spent quite a bit of time this weekend writing a parser for an ad-hoc JSON-like, only to discover that it has a painful bit of context sensitivity: a$b|c|d can mean a = [b,c,d] or a=b; c; d depending on how a is referred to on later lines
 
that sounds not very JSON-like
 
I think it's still possible in principle to parse it without ambiguity, but it's way outside the power of my piddling little recursive descent approach
@MisterMiyagi Yeah, I'm being generous with the term. Similarities include "used to represent data" and "separates elements in a collection using a delimiter"
 
well, that is at least 20% more adequate than most uses I have seen on SO
 
I made use of @PaulMcG's pyparsing and got a bit farther, but ultimately I don't think any approach employing PEGs and/or EBNF could capture the format's grammar
 
12:57 PM
@Kevin Wow, that's pretty nasty. If I were approaching that with pyparsing, I would create some kind of InterpretationPending class that would preserve the raw parsed tokens from a$b|c|d and then successively attempt to reconcile against subsequent statements. ("reconcile" logic left as an exercise for whomever thought up this syntax)
Is this Tcl?
cbg, btw
 
It's an in house language that has no name
While I have your ear, I have a suggestion for your upgrade-to-3.X endeavor: the first code block at pyparsing-docs.readthedocs.io/en/latest/… uses unparenthesized print
 
1:14 PM
Here is the source file: github.com/pyparsing/pyparsing/blob/master/docs/… Submit a PR and then you can be listed as a project contributor.
 
"Preserve tokens, then reconcile after the syntax tree is mostly constructed" might work... It could also be useful for the other thorny case, which is: x = any arbitrary value will try to eval the right hand side. If it parses, x is bound to the result. If it does not parse, x is bound to the string "any arbitrary value"
 
Scrolling down, I see a handful of other Py2 print statements, so your PR will not be quite so trivial.
 
I'm trying to avoid runtime evals so deducing whether the RHS is a valid expression at runtime would be ideal
I can try to put together a PR for the pyparsing docs but not until tonight when I have unfettered access to my github-facing tools
Oops, I meant "a valid expression at compile time". Darn this mobile interface.
 
@Kevin The urgency is low (not quite "Mariana Trench" low, but close).
 
I'll try to get it in before 2.7's EOL.
 
1:25 PM
I'm not waiting for EOL for Py3-only 2.5.0 release. Py2-ers will continue to be able to use 2.4.x releases. (Chopped another 60-70 Py2-compat lines from unit tests this weekend.)
I might make it pyparsing 3.0 to reflect its Py3-only-ness.
 
@PM2Ring perfect, thanks
 
@PaulMcG That's a reasonable thing to do
 
@PaulMcG we <3 modern python. No, wait...!
 
Heh
 
I was saving 3.0 for conversion to PEP-8 (pyparsing names are more camel-case than snake-case), but that might end up being pyparsing 8.0.
 
1:36 PM
link dupe of this
 
@AndrasDeak Nice.
 
Sam
2:06 PM
How can I subset a dictionary to include a list of unique key, value pairs? I can do it by value or key alone making use of set().. but not both
 
can you explain? a dictionary always has unique keys, thus all its (key, value) pairs are unique as well
 
dct.items()? :P
 
or do you mean that keys and values should be separate unique? i.e. (1, 2) and (3, 4) but not (1, 4)?
 
If you want to turn {1:2, 3,4} into {(1,2), (3,4)}, try set(d.items())
 
2:26 PM
Code golf: write an expression that evaluates to 1, without using any literal values, such as integers, bools, floats, strings, lists, etc. Example: len(str(list))-len(str(str))
 
can think of a few ways... none spring to mind that are great for golfing though
 
int() ** int()
 
int(int()==int())
 
nice x 2
 
@MisterMiyagi int-eresting
 
2:31 PM
I'm disturbed by that
 
my pleasure
 
abs(~int())
 
Nice
 
I initially thought i could get away with just ~int() though
 
-~int() # slightly improved
 
2:33 PM
ah, nifty
 
int(bool(__name__[int()]))
 
@ParitoshSingh sweet... how about just -~.... oh wait... kevin'd... meh... :p
 
ipython blasphemy:
>>> /-~int
1
 
And here I thought I was hot stuff with int(bool(id))
 
str().count(str())
 
2:35 PM
0 ** 0 is an indeterminate form, although it's often useful to equate it to 1. But I'm a little surprised that Python does that. en.wikipedia.org/wiki/Indeterminate_form#Indeterminate_form_00
 
@MisterMiyagi 0**0 giving 1 was a surprise, lmwtfy -> en.wikipedia.org/wiki/Zero_to_the_power_of_zero Kevin'd
 
@AndrasDeak I'd be massively surprised if that can be improved upon
 
@Kevin That is pretty clever.
 
int(int(sys.version[0]) / int(sys.version[0]))
 
0 is a literal
 
2:37 PM
:(
 
@Dodge use int() instead of 0 ;)
 
int(not int())
 
neat, I was thinking about not but didn't think of that
 
@Dodge i thought of this too! haha. But dropped it immediately just because of how long it got, and i was wondering if import sys would count towards the total count too. i assumed it should
 
it does
 
2:39 PM
@ParitoshSingh Not great for golfing that's for sure
 
I'm half inclined to forbid imports entirely, since that requires an extra statement. __import()__ is allowed but obviously tricky to use without string literals
 
Im wondering how much more interesting this problem gets if int() is explicitly not allowed as well
 
So why does int() return 0? Is that useful?
 
It's in the same vein as list() or str()
 
2:43 PM
many types return their "zero value" without arguments
 
Ahh ok that makes sense
 
@ParitoshSingh Next is something like len(str())
 
Next level: Code golf: Write an expression that returns that a string that contains a valid Python expression that evaluates to 1, without using any literal values, such as integers, bools, floats, strings, lists, etc.
e.g. '-~int()' would be a valid return value of said expression
 
almost a quine, I'm out
 
so just wrapping str around whatever worked counts? str(str().count(str()))?
 
2:46 PM
huh til Quine
 
@MisterMiyagi ha
 
That returns a string that contains a literal though
The returned string has the same rules as the original golf
 
now we're talking
 
Quines have always befuddled me - Klein Bottle logic. Ha! a Quine Bottle!
 
Imports are probably allowed now..
 
2:54 PM
@PaulMcG One of the most impressive quines I ever saw was in C. It wasn't just a quine, it was a palindrome.
 
wow
 
And then there are multi-language quine cycles. Eg, Program 1 in language A outputs program 2 in language B, which outputs program 3 in language C, which outputs the original program 1 in language A. But there are much larger cycles than that.
 
I once wrote a quine in brainf*** and it was like a thousand characters
 
@PM2Ring Funny semi-related thing about palindromes. I read a bit of a book called "The Princeton Companion To Mathematics. There is an article about what constitutes interesting research. In the article it said determining if there are infinite palindromic primes is not an interesting problem because palindromes are awkward to define mathematically... but in the same article it also said a proof of infinite palindrome would be a breakthrough.
 
@AndrasDeak It uses clever tricks with C's /* ... */ comments.
@Dair Also, palindromes aren't so interesting to number theorists because they depend on the number base you're using. But occasionally such "numerological" puzzles attract a bit of attention, eg primes that only contain the digit 1.
The rule of thumb is if it comes down to some quirk of base 10, it's boring, but if the same pattern crops up in other bases, it may be interesting.
 
3:03 PM
@PM2Ring yeah, or fault-tolerant quines
 
oh boy, I love the idea of Quines... I remember writing self replicating code for my security class...
 
@PM2Ring <strike>My impression was even in base 2 the problem was considered uninteresting.</strike> Although, I'm more surprised i breakthrough and not interesting are juxtaposed so readily haha.
 
also cbg \o
 
(lambda z=eval(keyword.kwlist[int()]): lambda o=z**z: lambda tp=str(tuple()): int.__name__ + tp[z] + keyword.kwlist[o+o] + tp[o])()()()
 
cbg
 
3:05 PM
@AndrasDeak That's pretty crazy. But using golfing languages gives you a lot of scope for weird tricks.
 
the fun times of learning what c's stack/buffer overflows could do, really opens your mind on the possibilities of things
 
I wonder if there are any turing complete languages that are impossible to write a quine for. Or if it's even possible to define such a language
 
elementary number theory in general seems to be littered with problems that kids can understand that researchers still can't prove...
@Kevin You always can. Kleene Recursion theorem.
 
@Dair In & of itself, the palindrome thing isn't worth pursuing. But stuff that shows unexpected addition-based properties of primes is significant, since primes are defined by multiplicative properties, and it's really hard to do additive stuff with them. Two examples of the latter are perfect numbers and Riemann's Zeta. Even perfects are related to Mersenne primes, but proving that odd perfects don't exist is currently intractable, although some impressive lower bounds have been derived.
@Dair I guess the simplest one related to primes is Goldbach's conjecture.
 
3:13 PM
@PM2Ring Yeah, there are also a bunch of rando conjectures on OEIS.
also collatz.
 
@Dair very cool. I expect they have to go out of their way to define the theorem without actually mentioning strings, since not every language has strings and not every language can print to stdout
 
I remember writing a collatz fractal and posted the code to codereview but never got any feed back :'(
 
... But you can still make what is essentially a quine in those languages by, idk, copying the program's bytecode into another segment of memory or something.
 
@Dair that just means your code is optimal :P
 
@PM2Ring The Riemann Zeta has a nice multiplicative interpretation, namely Euler's Product formula.
 
3:23 PM
@Dair One of the loveliest formulae in number theory. And understandable just using high school mathematics.
 
@PM2Ring Literally just choose anything with Euler in the name and you have one of the loveliest formulae ever.
 
@Dair wow, that's crazy
the fact that you can prove that is baffling
(because primes are magic)
 
@AndrasDeak Euler came up with the craziest stuff. There's a joke in the math circles that everything is named after the second person who discovered it because Euler discovered it first...
 
cbg-late afternoon
 
Case in point: the Riemann Zeta function is occasionally referred to as the Euler-Riemann Zeta function. Riemann was the first to perform analytic continuation on the function, but Euler discovered the product formula and also solved the Basel Problem.
 
3:28 PM
what should I do to have a list except for certains known elements of it?
example
 
(Although tbf, by modern standards, Euler's proof is not considered rigorous enough)
 
if value in list_of_numbers except the value 2 , 3 and 10
 
@AndyK if value in list_of_numbers and value not in list_of_forbidden_fruit:
or if you're checking against a set you can take the difference of that set with the excluded ones
and if there are fewer forbidden ones than valid ones then it might be worth checking the second part first in the list case
 
@AndrasDeak thanks Andras
 
no problem
 
3:50 PM
cbg
 
cbg
 
Regexp question: on an optional capuring group, if the group match, can I tansform the match?

re.sub('bar(|test)?','foo\\1','bar') # correctly print foo
re.sub('bar(|test)?','foo\\1','bartest') # print footest; but I would need foo_test?
 
what's wrong with using re.sub('bar(|test)?','foo_\\1','bartest')?
 
I don't think so, but of course you can always use ^ that
and you should use raw string literals for ease of use with regex, r'foo_\1'
 
@MisterMiyagi it would go "foo_" with the string "bar"; when I expect just "foo"
 
4:05 PM
did you mean to use the pattern bar(test)? perhaps? otherwise, what is your rule for transforming the match?
def foosub(match):
    if match[1]:
        return 'foo_' + match[1]
    return 'foo'

re.sub('bar(test)?',foosub,'bartest')
like this?
 
@MisterMiyagi the rule would be: since the capturing group is optional, I would need an underscore if it matches, otherwise not.
 
(|test)? always matches something
 
that was the goal
otherwise "bar" raises me an unmatched group error :)
 
let me rephrase that: it always matches ''
 
yup, the goal is to be able to transorm both "bar" in "foo" and "bartest" in "foo_test" (which I am an underscore away)
 
4:13 PM
please test the above code and let me know if it does not match your need
 
doesn't sound very regular to me, which is to say I won't be susprised if there's no pure regex solution
 
@AndrasDeak I find it amusing the MPI user mentions fault-tolerant quines...
 
well if you want to get the full grasp of it with a more true example:

/some/folder/optionalFolder/file.conf => /some/folder/file_optionalFolder.conf
/some/folder/file.conf => /some/folder/file.conf

I indeed have it in two different sub for now, but was wondering if I can make it one
@MisterMiyagi most likely. But can't do function as I am in an ansible playbook
 
@b.enoit.be there seems to be only one replacement that does not depend on an optional group
@b.enoit.be that would have been very helpful to know in advance
 
@MisterMiyagi sorry :x
 
4:20 PM
you cannot do that with pure regex
and it will be *much* more maintainable to have two separate replacements
 
Currently eight browser tabs deep trying to determine what Turing completeness really "means". The basic idea is easy enough -- can the language simulate a tiring machine? -- but I'm confused how this can apply to more exotic systems that don't necessarily have a concept of "memory", for example lambda calculus
 
@Kevin they can simulate state by modelling it as a value
imagine just swapping out your entire memory from the old to the new state
or go the other way around and have a look at Static single assignment
 
@Dair how so?
 
@AndrasDeak Because of the importance of fault-tolerance in distributed programming.
 
4:26 PM
i remember when I did some mpi4py I had no idea what fault tolerance was and boy was that an interesting time. Interesting times indeed.
 
mpi4py is really cool by the way
of course it doesn't hurt if you know how MPI works already ;)
 
but you probably use more traditional flavors of MPI right? Like either some vanilla impl of MPI or Boost?
 
vanilla MPI in fortran
 
do you use fortran?
 
yup
 
4:30 PM
yet here you are in the Python chatroom :P
 
I have constructed a language called esoK. It behaves like so: if the source file is empty, loop forever. Otherwise, print the source and exit. I declare this language turing complete because for any turing machine, there is an esoK program that prints the complete state of the turing machine after some finite number of steps.
 
whoa, whoa! Use? or used?
 
@piRSquared have used and using
@Dair 5 days on 60 cores. I do not want to do this in python :P
 
well then <tips_hat.png>
 
almost all my python is post-processing, visualization and the like
 
4:31 PM
You can get paid for 5 days on 60 cores, oooorrr you could get paid 500 days for 60 cores....
 
"wait, you guys get paid?!"
 
giggle
 
I remember when I was doing mpi4py some others and I tried re-implementing this paper but there were a lot of problems that never quite got resolved... :/ I'm actually not sure anymore if the paper is relevant anymore because of how hardware has changed...
 
EsoK can even simulate turing machines that never halt. Just run an empty source file, and it will perfectly simulate the never-haltness of any turing machine of your choosing
 
I remember that the paper relied heavily on knowing what piece of hardware a particular state was stored on and the distributed filesystem seemed to be like nope I can't let you know that chief.
 
4:40 PM
@Dair "Measurements on a 128-processor parallel machine" awwwwww
 
I'm trying to find a reason to deny esoK the distinction of being turing complete. I want to disqualify it because it doesn't accept inputs, but then I'd have to disqualify every language that doesn't listen to stdin
 
@Kevin I am decently sure that's not how turing machines work
 
i don't think magic the gathering accepts inputs but it is turing complete.
 
Conways game of life takes no input but it's famously turing complete
 
@MisterMiyagi Yeah it also looks like it was copyrighted 1999 so how fast is each processor?
 
4:45 PM
Maybe you could define input to include "twiddling parts of the initial state" but then I could just say that in esoK this is accomplished by twiddling the source code until it produces the right output
 
@Dair "a cluster of 128 Pentium Pros running at 200 MHz. Each machine has 128 Megabytes of RAM"
 
@Dair proceedings issued in 1999 narcis.nl/publication/RecordID/…
conference also in '99
 
my laptop is close to that memory...
 
Yeah, I was young and foolish (and still am). I should have payed closer attention to the dates and asked around if certain other hardware features could implicate reconstructing the paper.
(this is also what happens when you study math and never worry about hardware :P )
 
As usual I'm trapped in the bog that lies between "the actual formal definition of a concept" and "the lies-to-children description of a concept that sands off all the sharp corners"
I want to have my cake and eat it without first defining the category of partial recursive function admissible numberings
 
4:53 PM
Andras is probably like: "Why is this fool working on a cluster?" :P
 
This Just In: Tim Post says things about what the company thinks about being a knowledge repository and why the hubbub with meta meta.stackoverflow.com/a/388445/5067311
@Dair you have to try very hard to be so bad for me to question your raison d'etre on an hpc cluster :P
 
after all of the stuff tho I did learn: Basic MPI/SLURM syntax, distributed file systems are a thing, communication is costly, and big data =/= distributed computing.
and the paper I linked to is a perfect example why they aren't equivalent.
need to grind some work out. cya.
 
rbrb
 
5:34 PM
cabbage, all
rhubarb, @AndrasDeak
 
@holdenweb I was replying to Dair. Cabbage.
 
cabbage
Got a bit of an odd one here: can anyone think of a simple Python function (say a four line body or fewer) that isn't easy to write natively in Excel?
 
something with dates perhaps
 
Python lets me work with directories and files nicely, accessing all files in a folder or something, does excel do that natively?
 
5:42 PM
anything with files? :P
 
yay
 
anything with loops
 
Oh, that actually rings a bell. unless you go for VBA, excel did not really have loops for the most part now did it. There were some workarounds depending on the problem statement, but it was tough to build something that could take three elements at a time and build some logic on it or something along those lines.
 
If the Python were simple enough for a non-Python person to understand it at first reading that would be amazingly helpful. I'm working with the producer of an Excel add-in for Python, hence the interest.
 
5:50 PM
it that case i assume you count vba as a part of "natively in excel". Is that the case?
 
I wasn't thinking of that - just pure Excel functions.
 
I know it's an evil weapon, but...regex?
something something justifies the means ;)
 
Hmm, a regex that will be obvious ... isn't that a contradiction in terms?
 
6:13 PM
Not sure exactly if it fits the bill but the most obvious to me is that VLOOKUP always returns the first value encountered. You need array functions to get more than 1 result
The use-case for me was that I had all our customer orders stored against phone numbers. I wanted the dates of the last 5 orders placed by a phone number, but you'd just get the same date for each cell in your column without array functions, which aren't very intuitive. I guess it would be simple enough in Python but I don't have a proper concept of how it works re: the Excel side.
 
wim
frozenset is Python's hashable set, and Counter is Python's multiset. What's Python's frozenmultiset???
 
6:39 PM
@holdenweb You may find Newton Excel Bach interesting. The author is an old friend from a now-defunct science forum. He's done some work combining Excel with Python. I haven't had any contact with him for a few years, but he still has some of my old stuff on his site.
 
@wim I did timeit and actually your version is fastest - the version with frozenset is really slow. The overhead is killing it
 
Cool, thank you. And thanks to everyone else who contributed as well.
 
6:50 PM
Stupid JavaScript Trick on the HNQ: stackoverflow.com/questions/57456188/… I flagged it to ask for removal from the HNQ.
 
wim
7:06 PM
@AndrejKesely by a factor of how much?
 
@wim With the list from the question: yours 0.0027102880412712693, the frozenset: 0.015840377018321306.
 
wim
so about 5-6x
I wonder how long the inner sublists have to get before the answer from blhsing will overtake it
 
@wim when I do * 20 on every inner list, the performance starts to be roughly the same
 
wim
interesting, thanks.
 
wim
7:40 PM
@PM2Ring Andras will love that one
 
@wim It's a classic example of the sort of quirky behaviour that gets onto the HNQ but which isn't really a good example of what SO should be about. OTOH, I guess it's a great illustration of why Python doesn't do the zealous type coercion that JavaScript loves to do.
 
wim
looks like a rehash of the wat talk (nananananananananananananananana batman)
 
How to golf batman theme song in Javascript?
 
&#9834; this script is bananas, B.A.N.A.N.A.S. &#9834;
Gah, how do I get unicode to work?
I give up. Too tired :/
 
7:55 PM
🍌 ?
 
Basically, but it was supposed to be a musical note.
 
𝄠 𝄾𝅘𝅥𝅮𝅘𝅥𝅮𝅘𝅥𝅮𝅘𝅥𝅮𝅘𝅥𝅮
wait lol I can indefinitely paste the eighth note.
 
I guess I'll use the sandpit in future. I need to get away from a screen, it's been a 14 hr day and I think I've lost the plot more than usual. Rbrb for a bit.
 
i just copy and paste
 
wim
I have a little stack app for that, but I forgot where I got it
β˜πŸ‘ also Kevin's spoiler text button hehe
 
8:04 PM
@wim Careful, before you know it we're going to get those walls of text where every other word is an emoji
 
@Dair what's the markup/markdown/markallaround or did you just copy/paste?
 
I duckduckgoed Unicode banana and just pasted the first result.
(my internet is a bit spotty right now....)
 
the good things is that is searchable - ctrl+f and bananas :)
 
I still wanted the musical note and not a banana for the Gwen Stefani song :)
 
8:11 PM
I've totally failed anyway. "I need to get away from a screen" is just me leaving a house and switching to my phone instead.
 
@roganjosh Maybe you should learn to program without the internet... and then go into the woods flashes back to yesterday :P
 
Actually, I've barely used the internet at all today and was mega productive. I just tried to keep the momentum going for a bit too long. Then again, the effort is entirely useless without the internet because both projects are webapps :P
 
@roganjosh "Actually, I've barely used the internet at all today and was mega productive." Nice.
 
I was working on back-end stuff that I knew how to do. Don't try find a correlation :P
 
@roganjosh That's the point tho. It really forces you to hone the fundamentals and worry about data manipulation instead of allowing you to go for every library ever. My hypothesis is: When you use the internet too much you get npm.
but yes. I'll wait for more data points... :P
 
8:25 PM
The reality is that my work and my quest to make this yamming personal profile are fully aligned. I need to make a better API for my machine scheduling solver. I can't overstate my own naivety of "well, I have all these solvers lying around, ill just throw them into a personal site "
I'll settle for just 2 projects documented. I've got the vehicle routing one fully down, the machine scheduling is still not complete. The end is in sight, I just want it killed off and I'll add from there :)
 
cbg all
 
What purpose does a downvote serve here?
I'll just lose rep and I don't think it can change the ordering?
 
04:00 - 21:0021:00 - 00:00

« first day (3222 days earlier)      last day (1742 days later) »