« first day (3239 days earlier)      last day (1710 days later) » 

1:56 AM
Hammer'd!
 
2:37 AM
cabbage
 
3:32 AM
recbg
 
3:48 AM
hello
pls can anyone that understands how to work with regex very well using python help me out with an issue that im having
so i have a bunch of strings, but i only want to match something like this: imgur.com/a/r9y8l5S However, some strings wrapped with [] doesn't have any .png or .jpg, so i want to ensure that there is .png or .jpg, inside the square brackets wrapper. I have written this code by myself: imgur.com/a/2ed3iVO but this result is not appealing to all: imgur.com/a/P0PVMVc I don't know the exact reason of why it's working like that, can someone pls help or provide more insight
 
 
1 hour later…
5:21 AM
I'm trying to solve this problem -
Given a certain number, how many multiples of three could you obtain with its digits?
Suposse that you have the number 362. The numbers that can be generated from it are:
`3, 6, 2, 36, 63, 62, 26, 32, 23, 236, 263, 326, 362, 623, 632`
But only `3,6,36,63` are multiples of `3`
I need a function that can receive a number ann may output in the following order:
the amount of multiples and the maximum multiple of 3 among those numbers
 
Yeah, I have done with that
But getting TLE
Here is my solution -
 
Hmm, why len(digs)+1? Shouldn't that be len(digs)?
 
5:45 AM
@Aran-Fey No, we need the permutation with all digits also
 
>>> list(permutations('ab', 2))
[('a', 'b'), ('b', 'a')]
>>> list(permutations('ab', 3))
[]
oh, it's in range, that's why
 
range(1,3) will give upto perm('ab',2)
@Aran-Fey Yes
 
well, then I have no idea
 
cbg guys o/
 
6:27 AM
could you please help me
Depth = df['Depth'].tolist()
Depth_cycle = cycle(Depth)
nextDepth = next(Depth_cycle)
print (Depth)
count = 0
for i in range(len(Depth)):
    row_number = []
    PresentDepth, nextDepth = nextDepth, next(Depth_cycle)
    if PresentDepth > nextDepth:
        row_number = count+1
        row_number.append(row_number)
        print (row_number)
        print ("You need to insert row index at ",row_number)
        print ("You need to insert row",PresentDepth, nextDepth)
        count = row_number+1
I am getting AttributeError: 'int' object has no attribute 'append' Error
Line : row_number.append(row_number)
 
keep close track of what exactly row_number is
it's supposed to be a list, right?
 
row_number is list
I am trying append to list
Getting above error
 
are you sure it's a list? because the error message asserts is an integer. is there any way it could have changed?
 
cbg
 
cbg
 
6:32 AM
yes, I am sure.. It is List only
 
seems like you need to take a closer look at your code, then
 
You have a line of:
Which converts it to an integer
 
@U10-Forward psssst
 
*hand holding intensifies*
 
haha
 
7:20 AM
that's how the cookie crumbles
cbg :D
 
7:55 AM
Is someone familiar with NumPy internals? I'm wondering which file implements the base property; I'm curious how it's implemented. github.com/numpy/numpy
 
user10984358
heya, I have a file (more like a config file for some application) it can have contents like deviceOnePower='God Level'
deviceTwoSpeed='FTL'
deviceThreeStandBy='Ethernity' and so on
 
user10984358
my python program needs to read this config file and there is a module called "comment" which takes a line as its only parameter, which should then do a regex search in the file (to avoid cases like deviceXTurnedOn = Nah) and add in a '#' at the line start if it is a match
 
does anyone know what is the type hint for "takes an Ellipsis"? for example specialise(KeyError, TypeError, ...) - I would assume def specialise(*item: Union[Type[BaseException, Type[Ellipsis]]) but that just gives TypeError: Parameters to generic types must be types. Got Ellipsis.
 
user10984358
back referencing the regex and using the re.sub to add a hash (pound) can it be done?
 
user10984358
when someone calls comment('deviceOne') it should read the entire file and comment all deivceOne***, where *** can be any of Speed, Stand By, Power etc
 
8:05 AM
Mornin' cbg.
 
8:16 AM
cbg
 
8:27 AM
@MisterMiyagi does Union[Type[BaseException], 'ellipsis'] work?
TIL about Type[SomeClass]
 
8:49 AM
@Arne yes, 'ellipsis' works! TY
that is probably my new favourite WTF annotation: Union[Type[BaseException, 'ellipsis'], Tuple[Union[Type[BaseException, 'ellipsis']]]]
 
user10984358
9:44 AM
I’m sorry to nag ya peeps yet again, if I’m doing a regex replace (re.sub) in a file with 1500 lines will it be any good to first check if it exists using a re.search and then perform re.sub or will re.sub alone suffice??
 
user10984358
Right now I’m reading the entire file into a buffer and then doing the sub
 
there's no point doing re.search beforehand, that just makes you slower
 
10:01 AM
@TheNamesAlc they both just match the regex, their speed only differs in handling potential results. if there is no results, their speed should be the same
do you know how to write a timeit test?
 
10:17 AM
@IsraelObanijesu as a rule don't post images of text. Use text and we may be able to help.
 
@inspectorG4dget Thalaivaaa!!! Vanakaam.... Epdi irukkeenga? (In English, Leaderrrr!!! Greetings... How are you?)
 
@rishai arrays are implemented in c, odds are it's somewhere in github.com/numpy/numpy/blob/master/numpy/core/src/multiarray/… or similar
 
@TheNamesAlc if not, enjoy. spoiler: they have the same speed for non-matches.
 
user10984358
10:47 AM
Well I haven’t done those though I expect those when I come across questions like I asked. Thanks for the timeit.
 
user10984358
i have to do all these changes to a file. So if I’m searching before hand and if it returns a false then I don’t have to write the file from scratch. ( no applicable changes) I am reading the entire file content and using that as the re.subs third argument. That’s where the trouble of doing a search came into my mind.
 
user10984358
Re.sub returns the same file content if nothing matches the regex. So it doesn’t make sense for me to write the entire file when there ain’t a match.
 
I'd keep a copy of the original file content (as a string) around and check if it changed
 
user10984358
That did come to my mind so something like ogFileContents==re.sub(......) ??
 
comparing two strings is almost always gonna be faster than matching a regex twice
yes
 
user10984358
10:53 AM
I was just about to ask that. Lol thanks
 
11:35 AM
@thefourtheye You forgot to mention kalai and malai :D
 
11:47 AM
Has anyone used this Google's brotli ?
This thing takes array of bytes and compresses it.
I have a folder(Let's name it "A") with some/many files and subfolders inside it. And I need to compress all the data present in A.
What would be the best way to get bytearray for whole data present in A and pass it to brotli ?
One way could be to make a zip file of folder A. and then convert zip file to byte array and then pass it to brotli
Note: This folder A has html/css/js data, which will be loaded on iframe when requested.
offers 1 kilogram of cabbage to Andras Deak
 
*takes cabbage*
 
is if x is not None: equivalent to if x:?
 
@TheLittleNaruto no
@aadibajpai no
 
>>> def f():
...     if x is not None:
...             print("a")
...     else:
...             print("b")
...
>>> def g():
...     if x:
...             print("a")
...     else:
...             print("b")
...
>>> x = 0
>>> f()
a
>>> g()
b
 
12:01 PM
@AndrasDeak I do that always
 
@TheLittleNaruto doesn't make them equivalent in any way
try not to be the blind leading the blind
 
@Kevin Could you please explain why g() printed b ?
 
@Kevin is 0/False the only input where output will differ?
 
@AndrasDeak Okay! But so far I was using it.
 
@TheLittleNaruto if 0 means if False, so it fails the comparison
 
12:03 PM
>>> x = []
>>> f()
a
>>> g()
b
>>> x = ""
>>> f()
a
>>> g()
b
>>> x = set()
>>> f()
a
>>> g()
b
 
@aadibajpai keyword is "truthiness"
 
@Kevin Got it! Arigatou Watermelon
 
So [] == None but [] is not None.
 
@aadibajpai NO
just try that in a REPL
@TheLittleNaruto the simplest way to get bytes from your file is with open(path, 'rb') as f: dat = f.read()
 
bool([]) == bool(None) but this does not imply that [] == None
 
12:05 PM
[] is very much != None
 
@AndrasDeak Yeah! But I want some optimized and faster way.
 
U-huh.
use multiprocessing
 
@Kevin yea this was what I tried
 
@aadibajpai I think simple way to understand is when we use if something:, it expect "something" to be a boolean. Please correct me if I am wrong. @Kevin @AndrasDeak
 
@TheLittleNaruto open is very well optimised already. you need pretty specific use cases and hardware setups to beat it reliably/significantly.
 
12:08 PM
@TheLittleNaruto I don't think so
a string isn't technically a boolean.
 
Here's what the specs have to say about values in if conditionals and other such contexts:
> In the context of Boolean operations, and also when expressions are used by control flow statements, the following values are interpreted as false: False, None, numeric zero of all types, and empty strings and containers (including strings, tuples, lists, dictionaries, sets and frozensets). All other values are interpreted as true. User-defined objects can customize their truth value by providing a __bool__() method.
 
@aadibajpai Yeah since you didn't type cast it, it won't do typecheck, so python will execute it. That's what i think
 
TLDR: Python calls bool() on the conditional.
 
@MisterMiyagi Ok thanks, Then I'll go with open
 
cabbage good people.
 
12:12 PM
cbg o/
 
hi,

do you know hoy to receive path parameters using flask that contain "dash"? For example:

@app1.route("/<my-param>")
def index(my-param):
return "Hello {}!".format(my-param)
 
Wild guess: try def index(my_param):
My suspicion is that the name of the variable in the function signature doesn't actually matter and the parameters will just get bound to whatever is there
 
if I try it I can see the following error:

ValueError: malformed url rule: '/<my-param>'
 
Hmm
What happens if you also change the first line to @app1.route("/<my_param>") ?
 
@TheLittleNaruto Python doesn't have casting. if implicitly calls bool on its argument if it is not a boolean already. Same as for calling iter.
none of that is casting
 
12:26 PM
The Flask docs don't say it explicitly, but I think the variable parts of a route need to be valid Python identifiers. You can't have a variable named my-param in Python, so you can't have <my-param> in a route
Most languages disallow hyphens in variable names because they wouldn't be able to determine whether 1+a-b means "one plus a minus b" or "one plus the variable that has the name a-hyphen-b"
 
ok, thank you ;) I will work using _ instead of -
 
Yep, github.com/pallets/werkzeug/blob/… shows that only variables that match [a-zA-Z_][a-zA-Z0-9_]* are accepted. Letters, numbers, and underscores only
 
12:49 PM
Pedant's Corner: Ok, it is a small lie that Python calls bool() on conditionals. It calls PyObject_IsTrue, which does various things, including calling (*v->ob_type->tp_as_number->nb_bool)(v), where nb_bool is the object's type's __bool__ method.
The builtin variable bool doesn't get looked up at any point.
It's a little funny to me that if the conditional is already a boolean object, then it doesn't call PyObject_IsTrue at all, instead preferring to do a simple equality check on the object's id. "How should we see if x is True? Maybe use PyObject_IsTrue? ... Nah, let's not"
 
Then the real question is, does the builtin bool also end up here?
 
I remember this weird exotic case for the question "What's the fastest way to get the truthiness value of an object?"
$ python -m timeit "bool([])"
5000000 loops, best of 5: 72.3 nsec per loop
$ python -m timeit "not not []"
10000000 loops, best of 5: 23.6 nsec per loop
 
Perfect, so at least the world does make sense, and if cond: is equivalent to if bool(cond):
 
do they both call PyObject_IsTrue at some point and the difference in speed is just the function call of bool()?
 
1:00 PM
As far as I can tell, yes
 
@thefourtheye namaskaram thalai. Yetho wonga punniyathula nalla irukken. Oorula ellarum sowkiyamma? (Greetings boss. By your good karma, I'm doing well. Is everyone good back home?)
 
I notice that UNARY_NOT does not bother to do an equality check for actual bool objects, instead letting PyObject_IsTrue handle it
 
also, morning cabbages, all
 
Maybe it's a refcount thing... I dunno
 
@TheLittleNaruto you are wrong. It calls bool on the object.
 
1:28 PM
@Arne there is some lookup overhead in there
$ python3 -m timeit "bool([])"
2000000 loops, best of 5: 125 nsec per loop
]$ python3 -m timeit -s "_bool=bool" "_bool([])"
2000000 loops, best of 5: 101 nsec per loop
 
@BlackThunder the dup seems to be the opposite - waiting indefinitely
plus, it's in Java
 
@MisterMiyagi I missed that. Sorry guys
 
Thanks Andras
 
1:33 PM
Hmm, I thought that not not x would get optimized to cancel out the nots and replace them with some kind of implicit_bool_conversion(x) opcode, but looking at dis.dis("not not x") apparently this is not the case
 
cabbage
 
So the difference between bool(x) and not not x isn't just "the overhead of looking up the global name bool", but rather "the overhead of looking up the global name bool, minus the overhead of calling PyObject_IsTrue twice"
 
class Foo:
    def __bool__(self):
        return random.random() > 0.5
you can't optimize away not not foo I think
 
you can if the argument is True
>>> dis.dis("if not not True: pass")
  1           0 LOAD_CONST               0 (None)
              2 RETURN_VALUE
 
oh sorry, it ony calls not on the object once, the second one is on bool itself
so it could optimize it away
this is only because __bool__ is required to return an actual bool
@Arne it seems to work for immutable literals
>>> dis.dis('not not (-100,)')
  1           0 LOAD_CONST               0 (True)
              2 RETURN_VALUE
 
1:39 PM
What changes if __bool__ wasn't required to return a bool?
 
if it returns a WonkyClass then its __bool__ could be wonky, having side-effects and whatnot
 
Ok, makes sense.
 
I'm wondering if the status quo could be abused with side-effects...
 
@Kevin then meta programming would get a hell of a lot easier. and regular programming a hell of a lot more difficult
 
@AndrasDeak I wonder why i doesn't for mutable ones
how is not not [True] less optimizable than not not (True,)
 
1:43 PM
probably implementation detail
 
python is being strange? pick one:
- implementation detail
- refcount thing
- historical reasons
- pinhole optimization
- class scopes
did I forget any favorites?
 
honestly, what's the point of such optimisations? probably no one felt it worth their time
 
1:57 PM
Yeah, this doesn't come up in sane code. And we don't use python because it's blazing fast.
 
github.com/python/cpython/blob/… appears to be responsible for folding not <some constant> into <whatever the negation of that constant is> at compile time.
And also folding not a is b into a is not b
This doesn't really answer the question of "why didn't they implement not-folding for list literals too?". It tells us that not folding doesn't currently work on list literals because list literals aren't consts, but it doesn't explain why they didn't just implement not-folding for things other than consts as well
 
2:14 PM
Perhaps it would take more work to figure out what's safe to fold than it's worth. Although this would be compile-time cost.
 
"nobody felt it worth their time" may be correct. It wouldn't be a completely trivial change, because the not-folding function can't trivially determine whether a list literal is completely composed of constant values. It knows (1,2,3) is a constant and (1,2,x) isn't a constant because those nodes have already been marked as being ConstantKind or not. But it doesn't know whether [1,2,x] is a constant because it's been marked as List_kind, which is unhelpful re: constness
At a minimum you'd have to write a brand new "recursively check whether this literal is composed of only constants and collection literals that themselves are composed of only constants and collection literals that... etc" function
I reckon such a function would not be all that difficult or expensive, but the point is it's more than a one line addition to the not-folder
 
@AndrasDeak Okay Senpai
@MisterMiyagi 👍
 
On the topic of ast optimization, today I learned that x in [1,2,3] compiles to the same bytecode as x in (1,2,3)
The same cannot be said for x in [1,2,y] but it's still an interesting tidbit
 
2:30 PM
that's intriguing, TBH
not necessarily surprising, but intriguing!
 
lists and tuples share surprisingly much code
 
that actually doesn't surprise me
because lists are basically tuples with behavior (i.e. mutability) :)
 
it seems to be mostly the other way around, actually
IIRC tuple(iterable) actually builds a list first, then moves the items
 
that seems weird
 
tuple seems to be largely a frozenlist
 
2:33 PM
I would expect list(iterable) maybe to do that
but tuples are much smaller than lists
 
@MisterMiyagi AFAIK, it's not more than that. It's important to note that the addresses within a tuple can't be changed, but if the objects at those addresses are mutable, they can be. For instance, t = ([], 1), t[0].append(...)
 
Contrived example:
import psutil
import os



bunch_o_data = tuple(tuple(range(10)) for _ in range(1_000_000))
print('Tuple size:', psutil.Process(os.getpid()).memory_info().rss/1024/1024)
bunch_o_data = list(list(range(10)) for _ in range(1_000_000))
print('List size:', psutil.Process(os.getpid()).memory_info().rss/1024/1024)
Tuple size: 145.3046875
List size: 216.5625
 
Wild. I would not have expected that
 
tuple safes space by sizing down to the number of elements
 
2:41 PM
Hm... Though is that not tuple(*iterable)?
cause it's got that UNPACK in there
 
yeah, you're right - tuple(iterable) directly creates and appends to the tuple
 
Well, tuple(*iterable) isn't a thing XD
 
(*iterable,), my bad
 
Ah. So is that the tuple unpack creation then?
That actually makes a weird amount of sense
maybe
lol
 
well, technically tuple(*[[1]]) is a thing - I guess that is covered by BUILD_TUPLE_UNPACK_WITH_CALL , though
it's more useful with (*a, *b, *c) ;)
 
2:48 PM
Natch.
 
yeah, here it is: BUILD_TUPLE_UNPACK_WITH_CALL is f(*x, *y, *z) docs.python.org/3/library/…
weird
 
dupe Printing line with end='\r' on Windows doesn't work? -> How can I overwrite/print over the current line in Windows command line?. We keep getting the same-old same-old people trying OS/console-dependent tricks then complaining about Python not the console/IDE...
Thanks @WayneWerner
 
Their problem is that they're actually missing a stdout.flush()
sometimes it works without it
but my experience feels like about 50/50 chance that you will (not) need to flush
typically it only flushes on newlines, but I've also had it work without having to flush, so... shrugs
 
@WayneWerner Or run python -u unbuffered. But if we want programs to run under Windows console or universally, we can't rely on those tricks... esp. for progress messages in long-running task like OP's prime-sieve. Can't distinguish if teh task was hung/suspended/out-of-memory
 
\r works on Windows
 
2:56 PM
@AndrasDeak oh okay, my bad, stupid me didn't read the rules
 
it's alright
 
@smci ^^^
 
@WayneWerner Yes but the OP was asking about Windows(/DOS command line), and Windows PowerShell is not the default console. IIRC Windows has at least four builtin shells, and that's before we get to IDEs, third-party etc. The key point is to warn new users this is OS-and-console-dependent, and that '\r' is not some universal "magic character" for overwrite like bad Python authors tell newbies it is... and puts you at the mercy of each OS's sys.stdout flushing... i.e. don't write "too-clever" code.
...but you all already knew that :D
 
It works on every windows shell that I've ever used
it's not an overwrite character, which I've never seen it called
it's a carriage return
and anything that properly handles carriage returns will move the cursor to the beginning of the line, allowing for the appearance of a re-write :P
And yes, it is dependent on the console... but I've never met one that fails to behave properly because if you're displaying bytes instead of normal control characters then you're probably not going to honor a newline either
 
@WayneWerner Not really. Often the output only shows after the buffer-flushing delay, and like I said when you're prime-sieving on medium-sized numbers with delays of many minutes/hours between candidate numbers, that's simply a bad idea. Don't be too clever. \r is not universally handled the same way by consoles.
 
3:10 PM
Can you give me a console that doesn't actually handle a carriage return as a carriage return?
 
@WayneWerner Hey anyway, we should all be fully 3.x these days coming up to the Great 2.x Sunset... been meaning to ask here what the philosophy on both existing and new 2.x Q&A is. Esp where generic-sounding Q&A turn out to be overrun with old/stale/broken/unnecessary 2.x baggage.
@WayneWerner I just said to you multiple times that with-flushing behavior is different to without-flushing- it's not ok to wait hours for a progress message that was supposed to be instant (when I started on 2.x I encountered the same issue). That's the OP's problem. Beyond that, I don't have a Windows install handy, but there are tons of writeups on Windows console differences
...perhaps Fermat's marginal comment had a Windows console in mind... :S
 
I'm not talking about all of the other differences. There are tons of those. Just carriage return :P
me? I'd update the existing answers to include a python3 version of the answer, and then leave the legacy python pythoff version code below that
 
3:26 PM
recbg
 
cbg @AndrasDeak
 
cbg
 
cbg
two ISPs seem to have routing issues here w.r.t. chat.stackoverflow.com
so I had to ssh from Helsinki to my home computer in Oulu and use Socks proxy to just access chat :D
 
you probably didn't pay for Internet Premium #netneutrality
 
we're not in the States :P
 
3:42 PM
you didn't pay for SO Chat Premium
 
there's coffee coming out of my nose right now
 
;p
SO goes pay to play
 
@AndrasDeak Normally, we would charge $1000 per hour, but he won a competition. Hopefully, he doesn't waste that prize.
actually that doesn't make too much sense in this context. Nvm.
 
that was a reference to that, yes :P
 
3:59 PM
this is what the referance
 
Could Antti's internet problems be the work of an enemy stand???
 
unexpected JoJo
 
road roller'd over the cables
 
My ability, 「video killed the radio star」, eliminates all wifi signals within 100 meters
 
@inspectorG4dget @PM2Ring the problem with that prize is that it is for an unspecified length of time. At least it lasts until an RO kicks them.
 
4:13 PM
ahh yes. The RO giveth, and the RO taketh away kicks
 
4:52 PM
Is there an easy way to split a file path into segments and an anchor? Like '/home/me' -> anchor = '/', segments = ['home', 'me'] and 'home/me' -> anchor = '', segments = ['home', 'me']. I tried Path.parts, but that doesn't clearly distinguish between anchor and segments (Path('/home/me').parts -> ('/', 'home', 'me') and Path('home/me').parts -> ('home', 'me'))
The X of this XY problem is that I need to run an operation on each path segment and then put it back together
 
regexes?
idk
 
Is the anchor always "/" or ""? If the anchor is present, is it always the same character as the segment separator? Is the answer to the previous two questions "I'm not sure, which is why I'm looking for a ready-made solution, so I don't have to waste my time on file path minutae"?
Because that's definitely what the answer would be for me if I was doing file path stuff
 
I want to support windows as well, so the anchor could also be r'C:\' or similar
This 4-liner seems to do it:
anchor = path.anchor
path = path.relative_to(anchor)
segments = path.parts
path = anchor + os.path.join(*segments)
 
Smells cromulent to me
 
yeah I think it's acceptable if I slap a comment on top
 
5:27 PM
I think I can write a quine in the little esolang I wrote the other day, but it will be O((length of program)!)
 
...and How do I read and write CSV files with Python? is a confused mess of stale/2.x/unnecessary/confusing junk. It's a prime candidate for nuking or relabeling only before the 2.x Sunset
Repost: the existing Q&A on how to reading CSV with a header are a total mess. Mostly 2.x, disinformation about Unicode, etc.
Another case in point: going forward with 3.x, how can we prevent this old stale 2.x and by now wrong stuff cluttering searches under 3.x? without nuking it? I can't see an easy solution.
 
Proposal: remove the tag from all questions that only work in 2.X
Or is that what you meant by "relabeling python-2.x only"
 
proposal: use python 3
 
5:43 PM
@Kevin Hey guess what else is broken?! If you search this chatroom for [2.x 3.x]( chat.stackoverflow.com/search?q=3.x+2.x&user=&room=6) in this chatroom, it only (erroneously) finds one mention by Kevin with the formula containing x*x + 3*x + 2*x*y .... Not even my above comment, Jon's or many others. Wow that's so broken!!!
 
Chat search is... Not great.
 
it is the essence of not greatness
 
One day I hope to be able to search for things I said without having to choose my user name from a dropdown of 200 identical instances of "Kevin", or copy-pasting my numerical user id from another page
 
kevin #182
 
5:48 PM
still poop, but surprisingly more than nothing
your earlier message didn't show up in yours due to caching, it always takes a few minutes for that
 
@Kevin Forget chat search. Plain SO Q&A search on "python" keyword is broken for discriminating 2.x vs 3.x vs 2-and-3 stuff. We can't prevent SO search from turning up tons of old stale 2.x answers, like I said, and illustrated. I don't even see that "relabeling python-2.x only" is possible unless SO were to add custom support, which clearly ain't on the horizon. So, our favorite tag will be right mess by end-of-year.
@AndrasDeak The quotes are not needed in regular Q&A search: [python] 2.x 3.x
@AndrasDeak Yes, poop is right. Any thoughts on what will happen to [python] tag as we migrate to 3.x? Truly the search results will be unuseable for all non-expert users.
 
@smci I know, but regular SO search is also crap. That's why I suggested and use !ddso in duckduckgo
 
@AndrasDeak Uhuh but most users don't know about DDG, also DDG's coverage is of other sites is poor. Sigh...
 
 
1 hour later…
7:01 PM
Huh. Only an hour of file edits and maybe 20 server restarts, jimmies not quite in overdrive, before "hurr duhh, I'm reloading the wrong server". I'm improving :P
 
Spent twenty minutes today trying to figure out why the compiler couldn't see the changes I was making to my project... Turns out I was editing files in last week's backup
 
new goal --> 20 minutes :)
SSL turned out to be the most infuriating problem so far. I basically forgot that changing certificates takes time to propagate so I threw tonnes of circular edits at the problem yesterday, gave up for sleep and tadaa, it was working today. The lack of immediate feedback was... troubling
Or actually, maybe it doesn't, and it was just my circuitous mess finally working itself out when I attacked the problem from multiple sources
 
@MitchellvanZuylen Beware when imports are relative to (or dependent on) the current directory or path. Similarly (not your issue, but since you mention it), never have relative paths in your PYTHONPATH. And of course as a corollary, never have multiple versions/installs of the same packages at different locations in your PYTHONPATH. (This is very possible if e.g. a package was installed with both conda and pip). I don't have energy to go search if there's a good Q&A saying all that...
... And of course, on both Windows and Linux there's the whole crappy issue with administrator installs being a security risk (sudo pip install considered harmful, certainly as root), so individual users can have different/missing/broken/incompatible installs of packages (and their dependencies) such that code works fine for userA, but breaks for userB and userC, yet in different ways with different symptoms.
...So you've touched on a much bigger can of worms, and worm-related best-practices...
 
7:35 PM
@MitchellvanZuylen Spraying doesn't change the population at all, so it's really just an 'aphid tax' cost of N(t)*P. Presumably shooing resets the population to 0 that day, i.e. effectively the next-day population is 1. If we assume (WLOG?) the initial day-zero population is 0, then there's really only one key ratio involved, alpha = P/Q . If the initial population is large, we just shoo earlier, then repeat the sequence.
 
@smci you probably misdirected that ping because it was Kevin who was counting aphids, and that user wasn't involved
 
My answer ended up as 2*sqrt(q/p) so you're right about the ratio
 
@Kevin I think you assume WLOG the initial day-zero population is 0, because if it wasn't, you're effectively just starting on day N instead, before you get into the repeating loop.
@Kevin In general to see if a WLOG assumption is genuinely WLOG or not, try making the assumption anyway, then see if we can truncate/neglect a finite subsequence, offset, whatever. (Andras: yeah thanks, dangling reply-link in multiple chat windows)
(Kevin obviously you have to require P,Q are both non-negative and non-zero, otherwise you can get silly results.)
 
You can also assume WLOG that the solution for P=X Q=Y is identical to the solution for P=1 Q=Y/X
 
@Kevin What if the florist is in fact an aphid? (the Kafka scenario)
@Kevin Either way, people will sell you citizenships for them.
 
7:49 PM
i have an async function that returns x, is there a way that i can delay that return like 20 seconds?
 
@Kevin Now come up with difference equations where aphids also get to spray/shoo humans, who also reproduce/die (Lotke-Volterra?)
 
8:03 PM
recbg
 
Is this actually the standard for websites? If you F12 it, it has a Tweetie Pie picture to not steal the API token. I also have to expose mine in my site, I don't care too much because you could get one free anyway, but I need to provide a routing server on localhost:5001 to power the maps
So, if I now get nginx to serve routes from my own internal server on localhost, you could just freeload a routing server off me. That... does not sound right
 
@AndrasDeak you told me never to use sudo inside a venv, not even for using apt?
 
8:20 PM
I said don't use sudo python or sudo pip; apt should be unaffected by the python env
arguably you could deactive the env, use sudo apt and activate again, but I don't think that would make a difference ;)
 
@AndrasDeak got it, since sudo from inside the venv would refer to the system wide python/pip?
 
No idea what exactly would happen. But the point of a venv is to have a local setup.
(files in your venv would possibly get owned by root with sudo)
 
activating a virtual env is surprisingly un-magical. It mainly prepends my_venv/lib to the PATH of the current user. and yeah, sudo executes as root, who of course doesn't share your PATH, so it ignores the virutal env.
medium stress levels: waking up from a nightmare
high stress levels: joining a new team, "oh, we use python 2 by the way"
inhuman stress levels: "you have 10 seconds left to edit this message"
 
9:09 PM
god tier stress levels: "email sent"
 
sounds like you need gmail's "undo send" feature
 
i've sent emails that i then undo and rewrite ~5 times
i do need that feature
my life depends on it
 
if you use Outlook, there's a "delay send" feature. It put the email in your outbox and doesn't actually send until TIMEOUT minutes
 
gmail is basically the same, under the hood (for 10/20 seconds or something like that)
 
I excavate, I retag the carcass, I cast it back unto the earth whence it came.... Because the headline gave a false sense of recent and relevant. But just another anicent bug long-since-fixed.
 
9:22 PM
that's smart. I wonder if Outlooks delay'd send keeps the email locally or stores it on the server. In other words, does the email still get sent TIMEOUT minutes later even if I shutdown my computer after hitting send? is the delay on the server's side (like it is in gMail) or is it on the Outlook client's side on the local computer?
 
I would suspect from your description that it's client-side
after all the server it's connecting to doesn't support this feature; the client does
 
I would suspect so, as well. But the last time I saw this in action was when I was too naive to know to ask the question. Now, I would hope that MS has copied Google in turning this into an online feature (for at least hotmail/live/outlook email addresses) in order to keep up with relevant features in the domain
 
hotmail has become such an infuriating service to use (sorry, I needed that off my chest)
 
it's even worse to support (I'm Grandma's tech support, and she refuses to use anythig sensible, like not-hotmail... "notmail"?)
 
fighting talk now! :P
I have my email address and I like it. It's just garbage to try actually go through the inbox properly
 
9:29 PM
not worth it. It took me too many years to get to the point of "if anyone other than you touches your computer, I am never again doing any tech support for your computer" and "you are an additional line on my cell phone plan. That's it. I can't keep trying to figure out your talk/data needs and communicating that with your provider. I'll just monitor and adaptively find you the right plan from my end"
actually, I know that you can use your hotmail.com address as a gmail login. I wonder if that causes an email import. Though, I know that Thunderbird could be used to migrate actual emails and labels across mail servers, so there /is/ that
 
@roganjosh you only have hotmail? Adorable! How do people reach you when they need to?
 
I'm guessing IM, or make his phone ring the old fashioned way
 
@AndrasDeak smoke signals. The Amazon could be a real interference in future
 
Emissions of Carbon, 2ce already exists for this purpose
 
9v signals
 
9:34 PM
@roganjosh Amazon cloud...?
 
@roganjosh select all > delete > yes
that's the only proper I know of
 
@AndrasDeak as much as I hate to have to like that comment... kudos :)
I'm also slightly gutted I didn't see it myself, but hey-ho :)
@WayneWerner no no no, you just let your inbox make decisions about what is actually important. It's very easy. Just let it go do its stuff
 
10:23 PM
(Note to self, and other pandas users). There are tons of duplicates of the same simple issue: how to prevent pd.read_csv() unwantedly reading first row as header. The fix is simply header=None (not header=False, which gets cast to the integer 0, which is wrong). Here are lots of crap duplicates stackoverflow.com/…
... And here's yet another dupe today. They have a forthcoming date with Mjolnir. I mean the bloody 0.17 whatsnew from 10/2015 said so, as does the doc page. @cs95 we need ya, man.
 
10:34 PM
dupe this -> Prevent pandas read_csv treating first row as header of column names . I need someone else to close it since I earlier voted to close as too broad.
 
@smci docs could use some love, None case is clear as mud
 
@AndrasDeak True. The pandas docs suffer from overload. Line 1 should be a crystal-clear "Use header=None for no header". esp. since that is a common case. I will tie an extra knot in my pajamas to file a docbug.
 
Yup. None is only mentioned in the signature and as an aside for a non-None case
 
@AndrasDeak Yes the pandas doc sometimes suffers from being less of a simple help page, and more of a functional spec where basic yet crucial implicit behaviors are not spelled out. I will file a docbug and cite the huge number of SO dupes askings as justification why needs to be clearer
 
10:59 PM
cbg
 

« first day (3239 days earlier)      last day (1710 days later) »