« first day (2760 days earlier)      last day (2413 days later) » 

DSM
DSM
01:41
@wwii: did you change your avatar? 'cause I now wonder if I know what one of the Ws might stand for, and I'm pretty sure I haven't thought about that before.
No, once I picked one it has always been the same.
it's pretty much my initials - my username/id that is.
DSM
DSM
Huh. Oh, wait-- I know what it might be. I block a lot of avatar images, and the filter might have caught yours. I reset stuff recently and that might have changed things.
durn filters
That pattern caught your eye did it? Be you a lowland Scott?
DSM
DSM
Family came to the New World. Mom was born in Scotland; Dad's family has been here for two generations longer, but also Scots. My name's not quite "Angus MacHamish" in terms of being stereotypically recognizable, but it's pretty obvious for all that.
01:58
As fun as it is to pretend, I'm most likely pure american mutt. As far as I can tell we have been here 5+ generations. My dad never even alluded to a Scottish heritage till I was in my twenties. I was named after his dad.
DSM
DSM
Always strange to see someone link a question from five years ago and see that you'd already upvoted it. :-/
DSM
DSM
Not always -- OPs often miss important points. In this case I don't know I'd have worried about it overmuch, though, even before the OP said it wouldn't matter (your point that answers aren't just for the OP is a fair one.)
@cᴏʟᴅsᴘᴇᴇᴅ - why did you delete your answer?
^^ yes, yes it is
@wwii in light of recent events, I'd realised it wasn't generally helpful advice, because users may want that KeyError that I was so desperately trying to avoid, raised.
 
3 hours later…
06:05
recg
Hi, I'm trying to implement Dijkstra Algorithm and am using the networkx library.
With the following code, the weights are displayed correctly in the first block of print statements in initializesinglesource

0 0 35
0 1 12
0 3 13
0 4 21
1 0 27
1 1 33
1 2 8
1 3 29

However when we return from the call, the weight values are showng up as 0 and other increect values in dijkstra print block

0 0 35
0 1 0
0 3 0
0 4 0
1 0 39
1 1 33
1 2 0
1 3 28

def initializesinglesource(g, s):
nx.set_node_attributes(g, float("inf"), 'd')
06:41
Hello. I don't know. Is there anything that is missing from your example, or does this reproduce your problem? Also please read this on code formatting in chat
Hello.
I am unittesting an old project. I wonder why I am getting missing lines in the coverage report. These missing lines do not make sens to me. Here is a very short example:
``def function1(number):
n = number
return n + 1``
Sorry, lam formatted.
`def function1(number):
n = number
return n + 1`
still, but the function is too simple to understand. I test it like this: assertEqual(2, function1(1))
coverage report says the line n = number is not tested (missing). Why?
For future reference please see this for code formatting in chat
06:56
yeah, formatting multiline code in chat is done with ctrl+k, not backticks. Which coverage program do you use? I can't reproduce your example with coverage
Thank you Andreas Deak
def function1(number):
    n = number
    return n + 1
Unittested as: assertEqual(2, function1(1))
Coverage reports that the return and n = number are missing (not tested).
Why?
Cabbage
@wim Thanks for that. I guess the point you're making is that it's probably best to avoid using str.replace with an empty string as 1st arg. It's not documented, and it's not very readable, but I guess it can come in handy for code golf. But perhaps by using the count arg of str.replace I may be able to eliminate the slicing used in Jon's code.
07:22
cbg
@Begueradj no problem, Billeal ;)
I'm a little surprised, Begueradj, that you'd forgotten how to do formatting in here. ;) You used to be a fairly regular visitor...
Interesting. I just did some timeit tests, using strings of length 1 to 20. The version using the count arg of .replace is actually no faster than the version using slicing, and sometimes it's microscopically slower. It just goes to show how efficient slicing is.
word[1::2].replace('', '-')[:len(word)]
word[1::2].replace('', '-', (1 + len(word)) // 2)
And generally, the count version is only faster when the string length is even.
08:21
Does not look like I'm getting trough with this edit:
Perhaps someone else would/could do a change.
The answer is not wrong as is, but due to its age it does not reflect the current status.
guys i have received a file with *.i09 extension. Is there any way i could find the program which could open it?I have received the file where they didnt mention the program it could be opened with. Should I ask the sender or is ther any way to figure out on own?
user4229770
cabbage
@user3342816 Tricky. The reviewers who rejected that edit aren't Python coders, so they can't be expected to understand the Python 2 / Python 3 situation, and they probably assume that someone with 12k of rep knows what they're talking about. Also, changing the code in an answer is generally discouraged. I suggest leaving the author a brief comment with your suggestion. They haven't been active since early February, so they may take time to respond.
There are a lot of old Python answers that could do with updating to Python 3, but the Python community hasn't yet come up with a policy of how best to do that. And to do it for all pre-Python 3 questions will be a huge job.
@user3342816 I like your edit. I'll add a passage about python 3 and add some links to the documentation while I'm at it
@PM2Ring I update answers for python 3 without asking. The answerer can roll it back if they don't like it
Nice :),
08:40
@Aran-Fey Fair enough. OTOH, you can do edits without requiring approval.
I need some help figuring out why classes have a reference cycle:
>>> class C:pass
...
>>> c = weakref.ref(C)
>>> del C
>>> c() # it still exists
<class '__main__.C'>
I prefer to give active authors the chance to modify their answer themself. OTOH, if someone's been inactive for a while I guess an EAFP answer makes sense. :)
There isn't much that could hold a reference in an empty class:
>>> vars(C)
mappingproxy({'__module__': '__main__', '__dict__': <attribute '__dict__' of 'C' objects>, '__weakref__': <attribute '__weakref__' of 'C' objects>, '__doc__': None})
__weakref__ doesn't count for obvious reasons, and I don't think the __dict__ actually stores a reference to the class just to display attribute '__dict__' of 'C' objects
@PM2Ring Yeah, I don't like to edit other people's stuff either. But I don't mind nearly as much when the answer is years old and outdated :)
Turns out the __dict__ does actually save a reference
>>> C.__name__ = 'FOO'
>>> vars(C)
mappingproxy({'__module__': '__main__', '__dict__': <attribute '__dict__' of 'FOO' objects>, '__weakref__': <attribute '__weakref__' of 'FOO' objects>, '__doc__': None})
Should I answer this, dupe hammer it with Kevin's "Getting correct user input" canonical, or close it as a typo? stackoverflow.com/questions/50209733/… The OP is doing the right thing: they translated their German function names, and reduced the code to a MCVE.
08:57
Hmm, I guess you could call that a MCVE, even though the indentation is all over the place and there's a syntax error and the code throws away the return value of the function without assigning it back to user_tipp. I don't think it's worth keeping around like this, so if you close as dupe you should ideally edit it into shape
I had some trouble figuring out that a function named number_checker was supposed to convert and return the input. I'd just close that as typo or no MCVE and give the OP some help in the comments *shrug*
@Aran-Fey Well, it got closed as "No MCVE", which I think is a bit cruel when the OP did make a big improvement to their code in response to comments. Sure,, it doesn't have any sample input or error message, but for yam's sake, anyone capable of answering that question can see the problem without those things. And the OP did try to improve the question.
@Aran-Fey Take a look at the original version, which I think is the whole program. I can't tell exactly, since I don't read German.
@Aran-Fey Yeah, that's the culprit.
I think the question is unclear at best. Depending on how you look at it, "Why does my recursive function return None?" might be a better dupe target than Kevin's input thingy
I guess Teams is popular there are already 66 tagged questions on SO Meta
Does this mean everytime i want to use a function recursive i need to return the function? — Skryre 1 min ago
^ perfect timing
god this forum sucks hard — Skryre 13 secs ago
</sympathy>
09:14
@Aran-Fey Ragequit. Oh well, we tried.
They even deleted their account. It's a shame that an OP who put effort into improving their question ended up ragequitting, but the question wasn't good in spite of their efforts, so the closure made sense and the ragequit did not
@PM2Ring: Lol, I took the time to translate it, but got distracted by phone: paste.ofcode.org/XuBRtwXmGW6ibybbFH8aET - now to late ;)
09:33
@user3342816 Thanks for doing that. Yes, it's a bit too late to help the OP, since they deleted their account. But can you see the bug?
@Aran-Fey A lot of ppl are ragequitting
why?
Should I bother to keep looking for a decent dupe for this, or should I just post an answer that doesn't use exec. It's hard to find something that closely matches the OP's input format, and the possible targets I've found may just confuse the OP. stackoverflow.com/questions/50210802/…
A colleague of mine told me his son was ragequitting, crying when he was young
playing video games
is anyone here has this kind of bouts...?
very weird
Hey @vaultah You're very good at finding good dupe targets. :D Any suggestions for that? ^^^
@PM2Ring: Do not recall what he asked / did not read only skim. But there is an indentation error in the is_it_number_helper_function method. Beside that it should run ...
09:40
@AndyK I think it's mostly because people don't understand SO and think it's a forum, which it's not. When you post an unanswerable question on a forum, the worst thing that can happen is that you don't get any help. Here, your question will be downvoted and closed, and most new users can't take that kind of "negative" feedback
@Aran-Fey true
Even if there people being helpful in the comments - most OPs are still mad about the downvotes and close votes and in their anger they confuse helpful people with haters
@user3342816 The function is_it_number calls itself recursively. But it doesn't return the result of the recursive call. That's a bug. However, there's no need for recursion here.
"Why are these people criticizing me??!!" <- kind of like that
@Aran-Fey wise words actually
I do agree with you
09:43
Guess there is also quite a few that are in a somewhat hectic or frustrated modus when they post. Negative feedback then makes them go postal.
@PM2Ring nope, couldn't find anything useful
The format of that input file is too uncommon
@vaultah Thanks for trying. I don't like the existing dupe target. I saw that one in my own search, and a few better ones, but nothing that was close enough IMHO. OTOH, the OP hasn't been seen since they posted the question, so we might be waiting a while for response to the comments and answers. FWIW, they've had an account for 15 months, but this is their first question.
Ha. I just got feedback on a question from over a week ago. It's still as unclear as mud.
@PM2Ring: Yes, guess he perhaps thought the number was returned from the "recursive return". IIRC you mentioned that in comments, perhaps he saw it as well :)
Is there a way to try - catch on set.add() so I can raise when adding duplicates to set?
No, set.add doesn't throw an exception when it overwrites a value. You'll have to check if value in your_set before you do your_set.add(value).
10:01
:waves at the lurking invisible framework coding ninja:
Hmm, okay so I guess something like if 'x' in my_set: raise ... else my_set.add(x)
no MCVE stackoverflow.com/questions/50211391/… Although I'm also tempted to close as a typo...
@Ajit Do you really need to know if a dupe is being added? It's faster to just let set do the de-duping for you.
cbg
@PM2Ring Umm actually I want to raise/log all duplicates
10:12
@Ajit Fair enough.
10:53
please read the room rules
you can post that in the SQL room
sorry, I just find it pretty annoying when someone comes to the bakery asking for paint
forgot, of course :D
you really should post that in the SQL room though if you want to help
no one's online so i guessed someone here would have worked with it
I was talking to Ashish after "please read the room rules"
@AndrasDeak I did, better there than here
10:59
yup, thanks
no u thanks :-p
@AndrasDeak apparently I can't :|
ah, I see
well, there's that :P
makes sense, but anyway too much trouble (for lot of people) for a wanderer.
11:29
The cute / aww pics have become wayyyy too infrequent here :(
:)
11:54
TIL i * i is around 3 or 4 times faster than i ** 2. See stackoverflow.com/a/50212230/4014959
That one has a CV for a dupe (if interested, vote to keep it open - stackoverflow.com/review/close/19656045)
In [24]: %timeit i=10; i**2
242 ns ± 11.5 ns per loop (mean ± std. dev. of 7 runs, 1000000 loops each)

In [25]: %timeit i=10; i*i
30.4 ns ± 0.285 ns per loop (mean ± std. dev. of 7 runs, 10000000 loops each)
In [28]: %timeit i=10.; i**2
56.3 ns ± 0.551 ns per loop (mean ± std. dev. of 7 runs, 10000000 loops each)

In [29]: %timeit i=10.; i*i
31.2 ns ± 0.398 ns per loop (mean ± std. dev. of 7 runs, 10000000 loops each)
eh, your CPU got warmed up by In [28] :-p
12:00
wonder if it has to do with long ints
python 2:
In [1]: %timeit i=10; i**2
The slowest run took 97.07 times longer than the fastest. This could mean that an intermediate result is being cached.
10000000 loops, best of 3: 61.4 ns per loop

In [2]: %timeit i=10; i*i
10000000 loops, best of 3: 36.3 ns per loop
In [1]: %timeit i=10.; i*i
23.6 ns ± 0.199 ns per loop (mean ± std. dev. of 7 runs, 10000000 loops each)

In [2]: %timeit i=10.; i**2
41.7 ns ± 0.404 ns per loop (mean ± std. dev. of 7 runs, 10000000 loops each)
@AshishNitinPatil Rejected: the proposed dupe target doesn't mention using splatting to print a generator.
Can you also try running the i*i before the i**2?
@AndrasDeak I tested my code over various ranges, up to 10**30 or more.
In [36]: %timeit i=10.; i*i
31.5 ns ± 0.718 ns per loop (mean ± std. dev. of 7 runs, 10000000 loops each)

In [37]: %timeit i=10.; i*2
40.2 ns ± 1.44 ns per loop (mean ± std. dev. of 7 runs, 10000000 loops each)
@PM2Ring I mean that even small ints are long ints in cpython which might mean more work for taking a power
12:04
I have a faster CPU (and it matters which operation is performed first) :D
@AndrasDeak Oh, ok. I see what you mean. I'll see what results I get on Python 2.
@AshishNitinPatil I'm not sure
FWIW, I have a little more confidence in custom timeit code than in ipython shell tests. ;)
@AshishNitinPatil Even when you do ten million of the same operation in a row? Weird!
12:07
OK I found how to get rid of the assignment overhead
In [43]: %%timeit i=10
    ...: i**2
    ...:
216 ns ± 2.54 ns per loop (mean ± std. dev. of 7 runs, 1000000 loops each)

In [44]: %%timeit i=10
    ...: i*i
    ...:
26.1 ns ± 0.336 ns per loop (mean ± std. dev. of 7 runs, 10000000 loops each)
and that's the same with reverse order ^
@PM2Ring I definitely wouldn't
@AndrasDeak maybe it's because of not knowing the internals :D (like you pointed (effect) out correctly in the latest results)
no, it's because you need to measure what you want to measure
i.e. as little overhead as possible
I just usually time things where the setup is negligible so I don't have to bother about that
micro nano-optimizations are a diferent thing
yeah, in this case it's heavily affecting results
I also got around 8x factor matching your results (irrespective of order)
Which (as expected), carries over to higher powers as well
I have no idea how arithmetic operations work, so I don't know if we should be surprised. It is much harder to compute a power in general, and even figuring out if you can short-circuit to multiplication takes CPU time
Interesting. In both 2.5 and 2.6 the speeds are much closer. For small numbers, starting with num=1, mul is still the winner, but rarely by much more than 50%
But with big numbers, the speed difference is larger than in 3.6. If I start num at 10**10, then mul is around 9 or 10 times faster.
With Python 3.1.3 I get similar results to 3.6.0
@AndrasDeak I don't think pow / ** does much optimization. Computing powers of two with them is definitely slower than doing bit shifting. I posted code for that in here almost a year ago.
12:24
I see
For small powers it's already pretty bad. For large powers the difference soon becomes astronomical.
OTOH, the 3 arg form of the pow function is nice when you want modulus powers, far better than doing a ** b % m
DSM
DSM
12:51
Cab ** ba % ge!
TypeError: unsupported operand type(s) for %: 'int' and 'builtin_function_or_method'
but cbg still
@Aran-Fey done
How weird. I was just looking at a great circle problem on SE.mathematics when I got an upvote on an old great circle answer I wrote on SO. Unfortunately, the new SE.mathematics question is about a bug in some Perl code, and although it looks fairly well written, it does use a bunch of single letter variable names, and I don't read Perl too well. math.stackexchange.com/questions/2770545/…
@PM2Ring those variable names give me anxiety
13:00
you got an upvote because it's a great circle answer
so if I do decide to make my variable names a - z, what happens if I refactor one away? Do I shift them all appropriately? Go to aa - zz?
Give up and throw my computer out the window?
use exec to refactor on the fly
I like spherical trig, as you might guess from this monster answer. But I haven't touched that stuff in ages, and it's easy to get confused with it if you aren't careful. :)
My guess is I got the upvote from this guy who just added a comment:
Note that this package is also available for Anaconda: > conda install -c conda-forge geographiclibJoël 12 mins ago
new week cbg \o
13:13
cbg
@DSM do we have the technology to stop giant meteors from smashing on earth? (half curious about the serious answer, half jokingly towards tonight)
Oh and question is open to anyone else for the serious part of the answer :\ I wonder if we have some sort of docking engines to the meteor to thrust it away from the Earth.
Grrr. From a deleted question mentioned on SO meta Helper:"Your link will rot in a few months and the code will be gone and this question and any answers will no longer be useful for others. Please edit the code into your question so it remains useful to others." OP:"Don't worry I will put the code here once I've found the answer"
@MooingRawr I'd be surprised
@MooingRawr It depends how much notice we get. If we have years, it's not that hard to do. If we had months or days, forget it.
DSM
DSM
@MooingRawr: with enough notice, probably.
Kevinned from Down Under already. Monday's not looking good.
13:21
it would take a loooot of momentum to push something away. And remember what a huge deal Rosetta landing Philae on Churyumov-Gerasimenko was
wrote a blog post yesterday about bandit problems in reinforcement learning; blogpost was at #1 at hackernews but dropped to #5: news.ycombinator.com
and that was only partly successful
Bear in mind that the Earth's a moving target, so it can be hard to tell if a killer asteroid will actually hit us if we don't have good orbit data for it.
I remember watching a documentary (perhaps on Discovery), where they tried different solutions. Nukes weren't a good idea and would barely dent large scale meteors, there was a solution to fly something beside it in hopes of the minor gravity would change the trajectory but I don't remember why that wouldn't work. Thrusters were the final solution but even then it seem grim.
"too small mass" would be my guess for the gravity thing
13:24
I think at the end of the day PM, you are correct, if there's a giant meteor flying towards us we would be out of luck :\ (I was hoping there was a new solution since that documentary)
whatever risks Earth will just shrug off whatever we can put in orbit
The Earth travels a distance along its orbit equal to its diameter in around 7 minutes. So there's roughly a 7 minute window whether we get hit or not. Of course, that presumes a side-on collision, and it neglects gravitational interaction between the Earth and the asteroid.
DSM
DSM
There are lots of options, at least on paper.
I hope some of them include "put Earth elsewhere instead"
Well I think I'm going to enjoy the Parker Solar Probe that Nasa is doing, even though I don't have any clues about anything outside of Earth.. To your point AD, I remember reading something about Nasa(?) thinking of sending people on a one way trip to Mars.
Not sure if the Mars thing will be a thing...
13:27
At least they'll have a free car to roam around :-p
(of course it won't be on Mars)
I can understand people wanting to go to space, and Mars is one of the traditional destinations in scifi. But it's not really a fun place to live. The middle of Antarctica is generally far more hospitable, and generally warmer.
But I presume the asteroid can't be too huge in size, otherwise why would it collide with Earth and not anything else first? The odds would seem to be in our favor for that.
That wiki list is actually pretty interesting, especially the Gravity tractor.
@PM2Ring also air
Jupiter probably catches a lot of the rocks headed from the outer solar system to the inner system. OTOH, it could also deflect stuff our way that we wouldn't otherwise catch, so it works both ways.
13:29
@PM2Ring relevant gif imgur.com/gallery/zmd7N
3
Too early for space exploration, too late for Earth exploration (not that I would have wanted to explore the Earth since the conditions were terrible back then)
@AndrasDeak I counted air & water under "hospitable".
OK :)
@MooingRawr what do you think space exploration will be like?
Jupiter the real Most Valuable Planet, or MVP for short :D
@AndrasDeak Nice!
13:31
@AndrasDeak like the sci fi shows I watch :D since I'm still ignorant in terms of what the reality might be
"enclosed in a few cubic meters of not-entirely-lethal-to-humans" starts to cover it :D
and rather than crush the hopes and dreams of another goal, I would like to stick my fingers to my ear and lalala my way into space exploration, until reality hits me like a truck meteor
tagline: "so many ways to die"
I read a sci fi book/novel/light story where when someone was terminally ill with no cure, they shot the person into space on a giant circle at high speed, so when they return to Earth, hopefully the cure would have been found. (it also when into the issues that this faces but that's besides the point)
giant rotating circles in space do tend to end suffering fast
13:37
@AndrasDeak Relevant video : youtube.com/watch?v=IJNR2EpS0jw :-p
yup :P
I don't want to victim-blame but if you die exploring space you had it coming ;)
timestamp: 1m12s for that :-p
hehe :D I didn't remember the details, I'll give it a rewatch later
@MooingRawr Getting a human + space vehicle up to a high enough speed for relativity effects to become significant takes a lot of energy. Unless we discover some neat magic trick to do that, it'd probably be way cheaper to just throw a few trillion dollars into curing their disease. ;)
Here's the classic Usenet article on the topic: The Relativistic Rocket
(yamming paste buffers) That article, along with a lot of other old Usenet physics stuff, is hosted by mathematical physicist and proto-blogger, John Baez.
waiting for future advances in science and tech also runs the risk of xkcd.com/989
13:46
can I make a function work with a normal parameter and a generator?
please elaborate
def a(x):
    return x+5
elaborate some more :P
how can I call that function passing as a parameter a generator of x
your function should handle the kind of inputs it accepts...
13:47
deg x_gen():
    yield random.randint()
:S ok
there's no magic
I think I can handle that
unless I'm misunderstanding
@AndrasDeak Ah yes. That's a classic.
@AndrasDeak no, that's my problem actually :D
13:48
you can try to see if you can handle the different kinds of inputs on the same footing, but only you can determine that
for instance if your input can be a list or a generator you can either consume the generator into a list (assuming it's finite), or you can handle the list the same way as the generator, either implicitly or by using its iter()
@Neoares What are you actually trying to do? Do you want a new generator that adds 5 to each value yielded by the 1st generator? If so, just do a gen exp.
basically I have a function that yields pandas' dataframes, and a function that takes a dataframe as an argument, does some magic, and returns the dataframe modified
"function that yields pandas dataframes" sounds very scary
I just want to process all my dataframes but one by one, cause I don't have enough memory to fit them all
@Neoares BTW, that's a pretty feeble generator, it only yields a single value, then it dies. Maybe you meant to put a loop in there...
13:51
yield pd.read_pickle(file) xD
yeah I have a loop
for file in paths:
    yield pd.read_pickle(file)
if this is about 10GB-file-eats-26GB-on-read, you can try just putting all those dataframe chunks into a list first
it's possible that after the processing is over the overall memory is not that much more than 10GB
@AndrasDeak it's possible after the processing
and you may be able to use pd.concat to glue them back together
@PM2Ring oh I see, I still enjoy the concept but like most sci fi, they are fake a stretch from the truth
yes, I'm doing pd.concat(generator)
but now I want to do pd.concat(process_function(generator))
or something like so
13:53
so why not do the manipulations on the result?
if it fits in memory I guarantee it will be faster
because of scalability
that's not a term I can meaningfully comprehend
if suddenly my dataset gets 10x bigger, I won't be able to do this without a generator
well, I would be able to do a simple loop calling the process function
but idk, generators look so cool that I wanted to use it :P
map(process_function,generator)
13:55
that will give you another generator (in python 3)
I'm using python 2 Q_Q
don't
it will still work but you'll end up with a full list rather than a lazy generator
well, I can pass the full list to pd.concat
but it won't be webscale
the thing I want to avoid is storing all the entire dataframes without the preprocessing
I understand that map will execute the funciton 1 by 1 (I'm not sure)
13:56
Sure. But really, do use 3 unless you have a very good reason not to.
and since you're doing data processing, the only valid reason would be "unsupported dependency", which you can't have because pandas
I know
@Neoares try and see, and/or look at the docs
I'm gonna change my prints :D
13:57
good luck :)
there's also the 2to3 tool that changes the prints and other trivial stuff for you
it's k, I already change them
I just have to install everything with pip3 now
yup
or python3 -m pip to be sure
or use a virtualenv and inside just pip
temp cbg
aaaand rbrb
13:58
tmpcbgrbrb
I broke pip lol
lies
@Neoares What Andras said. There's no good reason to write new code in Python 2. Upgrade ASAP! (But in the meantime see imap)
pip3 install --upgrade pip broke pip xDDD
Oh, right. imap. Meh :P
python 3 is so natural to me that I don't even think if there's a reasonable alternative in 2
14:00
which is how it should be, unless you are maintaining archaic systems
@Neoares I suggest you take off, and nuke your entire Python installation from orbit. It's the only way to be sure.
it's a virtualenv
unless it's linux
I just freeze'd my requirements to a file
14:02
there may be some modules that have different names in 2 vs 3
removed the env, created a new one with python3 as a default, and then pip install -r requirements.txt
^^ Also, some versions might be incompatible with Python3
yes...
since pip freeze will include my main package dependencies... it's better to just manually install my main libraries
you shouldn't have much more than, I don't know, pandas, sklearn and whatnot
@Neoares yup
DSM
DSM
I tend to keep a base set of requirements (like 'pandas') and freeze based on that. I mean, it's no concern of mine when pandas changes its list of two dozen dependencies, etc.
That is, I use the base reqs to build a 'current' env and freeze that for exact reproducibility.
14:05
yeah, but I'm used to npm
which automatically does that
sniped
Hey @DSM The other day I learned about Wikipedia's Mathematical coincidence page. I was familiar with a few of the entries there, and I suspect you are too, especially after doing stuff with OEIS. But there's some stuff there I had no idea about. For example, a sphere of radius n kilometres has a volume slightly over cubic miles.
Google says: (1 km)^3 * 4*pi/3 in cubic miles = 1.00494421 cubic miles
km vs miles is as coincidental as it gets :)
DSM
DSM
14:16
.. or is it? O.o
I'm not even sure it qualifies as "mathematical" :D
Yeah, it's more "numerical"
it seems that map(function, generator) is not giving me another generator :/
except python calls it map_object but it's indeed a generator
@Neoares how so?
your two messages seem to be contradictory
Mathematical is more like 1/pi ~= 113/355
14:18
They say you can convert between miles and kilometers by comparing successive numbers of the fibonacci sequence. Eg. 13 miles = ~21 kilometers. I wonder if this passing resemblance to the golden ratio makes it likely to crop up in other irrational contexts
@AndrasDeak well, i tried it, and it gives me a map_object
what's un-generator-like about it?
@PM2Ring yeah, or the infinite cosine product integral and friends
@AndrasDeak sorry what
@Kevin Well, there are some pi ~ phi connections mentioned on that page. Ramanujan found some doozies.
you said map gives you a generator if you provided a generator instead of a list (in python 3)
14:19
@Neoares You want a generator. Surely you have a use for a generator. What property of that map_object doesn't cut it for you as a generator?
@Neoares map gives you a generator, period.
@AndrasDeak well, I gave that map_object to pd.concat, but it didn't work
how did it not work?
maybe I'm missing something very stupid
it seems to me that phi = p*h*i = p*i*h = pi*h. So we just have to determine the meaning of this "h" value, and the secrets of math will open up to us
now it's working
let me scroll and check what the heck did I do
14:23
@Kevin p is momentum, h is Planck's constant, and i is the square root of -1. Now we just need to choose the right momentum to make phi. :)
ok, I found the error :D
passed a wrong parameter so the generator was giving me nothing
I'm leaving now anyway
good luck generating
that's why I got ValueError: No objects to concatenate
14:25
hence "how does it not work?"
see you! and thanks
now it works
yes, but errors are usually quite informative
I thought the error meant the generator was not correct
FWIW, phi = 2*cos(pi/5) It's a nice exercise in geometry / trig to prove that.
something something regular pentagon
14:27
Indeed.
14:48
Cabbage
@PM2Ring "Nice."
This person just submitted their 1st answer, after being a member for 10 months. I'm trying to convince them to add some text to their answer...
Your answer will be more valuable if you add a little bit of explanation text. — PM 2Ring 8 mins ago
@toonarmycaptain May involve pulling out some hair if you don't figure out a good "angle" of attack. :D
It's possible I'm missing something. I'm being warned about a security issue due to an assert statement (which would be potentially compiled away). The statement is in a class definition, and asserts that the set of items in one list are contained in the set of items in another list.
I used an assert statement because that condition being false should "never" happen, because I have checks for that inconsistency before the class is instantiated. Am I using assert wrong?
I thought the answers would explain the bug(s) in the OP's code, since the question is obviously a dupe... if you aren't gonna explain the problem, why not just hammer it instead?

« first day (2760 days earlier)      last day (2413 days later) »