« first day (2767 days earlier)      last day (2406 days later) » 

13:00
When you put method(value) inside a dict what happens is the return value of the function gets stored, so the function has to run first. This is why I said that python doesn't have switch-case.
@AndrasDeak is now cool?
in switch-case you'd expect each case to only be executed when it's their case
jpp
jpp
stackoverflow.com/questions/50329280/… Unclear, no mcve, no response.
@Skizo-ozᴉʞS have a new link?
13:01
almost, but methods implies plural, but you're assigning a single function to it ;)
with methods I got the current method and then I pass the value
Yes, that's correct. Just rename it then.
I can have problems with reference?
My suggestion was methods -> choose method -> run method, now you have the first two steps in one, which is not a problem but this should affect your naming
Now I do not have the list(value)
13:02
@Skizo-ozᴉʞS no, no, just style :)
Then I don't need the stuff list(value)[:]
Whether or not you need a copy depends on what the functions do. This is again independent of your dispatch problem.
if the jumpLeft etc methods can change state passed on input and you don't want that, you'll need to copy state before passing it into the method
note that your original didn't do anything in this regard!
new_state = list(state)
if ...:
    new_state = # overwrite the original state-copy with a new variable by the same name
that first line was basically a no-op
Then wasn't necessary that list(...)
because it was overwritting stuff
If you want to protect the original state from being mutated by the method calls, you need something like method(list(state)). BUT another warning: this will only give you a copy if state isn't a list of lists or something similarly nested
Python is too hard :c
13:05
if you use list(state) it might still happen that your state gets changed
anyone good with AWS design?
@Skizo-ozᴉʞS mutability can be confusing:) Read this: nedbatchelder.com/text/names.html
@qaispak Amazon seem to be, maybe? :)
I guarantee that it will be clearer once you've read Ned Batchelder's take on the subject
haha, they won't give me the time of the day
13:06
Yes, I know it from Java
I am having a disagreement with a coworker
about some design
so need second opinions
Should be the same the word "reference"
@qaispak does this relate to Python though?
but python might behave differently from what you expect in java, so I do suggest reading it to be sure
You probably can formulate a valid understanding based on references, I know others have. But there might be subtle differences which I don't know about because I was never taught about references :P
@JonClements the code is in python.... but no not 100% python :/
13:10
Um... using stuff like AWS/GCP/Azure etc... design choices are pretty varied as you've also got their own platform service offerings and integrations and all sorts....
so unless it's a very specifically python or someone's willing to share their networking experience.... going to be tricky I'm afraid
Ya, Andras is a nice doc
So, since I do not want it to be a refernece I can do something like new_state = []
Because I don't know why I was copying it if I was changing the content later..
Step 1: what is state?
new_state is whatever your method returns, so if you want to copy you should probably implement your method in a way that it returns a copy
check edit link I've edited with 1 method all of them are the same
@JonClements Can I just ask this: Your code is reading a config file from somewhere and you want that config file to have a new state every day. Should you update that config file at the end of your code or through another program
@Skizo-ozᴉʞS OK, so what is state? What kind of object? What is its structure?
13:14
()
Cabbage y'all.
I hope that's a typo and not an answer :P
cbg, holdenweb
@Skizo-ozᴉʞS Are you saying that state is a tuple?
I always confuse about [] ()
that's why I put () :(
that's not an answer either way
Anyone know enough ReST to know how to avoid a line break at a particular point? It's along time since I used ReStructured Text ...
13:16
the answer I expect is "it's a list of lists", "it's a tuple of ints", something like that
It's a tuple of chars
if it's a tuple of ints then state is immutable to begin with :)
because tuples are immutable and ints are immutable
Hello
There is a function in pandas to write or replace a cells in xls or i have to import ExcelWriter module as well ?
It's ('A','B','C') for instance
still fine, strings are immutable too
you can only be bitten by references if part or all of your data is mutable
you can mutate lists in a tuple of lists, for instance
but you can't mutate a tuple of strings, so you're fine
13:18
So new_state = list(state)[:] isn't necessary?
when you do list(state) you're already creating a copy of your input tuple, so that's all you need to do
Ah I see
@Skizo-ozᴉʞS you need the list() part in order to mutate the new_state, but you don't need the additional [:] which wouldn't do anything either way
list(...)[:] is always the same as list(...)
what you might have had to do in order to get a proper (deep, not shallow) copy is copy.deepcopy(state) or something equivalent, but this is not necessary since you have a tuple of strings
13:20
@AndrasDeak Then, returning to here
@holdenweb I don't think I understand the question. IME it's a lot like SO's markup - single line breaks are ignored, and two or more consecutive line breaks create a new paragraph
That you know what is state
@Skizo-ozᴉʞS yup
I have to do the same list(state)
yup, since you want to change the elements
either that, or you need to put together your output from pieces
13:22
I mean, nono, I had to return a new state but not the old one moddified
as a tuple
something like state[:position-1] + ('-',) + state[position-1:position] + state[position+1:] which wouldn't be more readable
@Skizo-ozᴉʞS yes, your input tuple -> list -> modified list -> tuple(modified list) will do just that
what's that?
@Skizo-ozᴉʞS it's how you'd put together the output tuple without creating a list from the tuple :D
>>> state = ('A', 'B', 'C', 'D'); position = 2
>>> state[:position-1] + ('-',) + state[position-1:position] + state[position+1:]
('A', '-', 'B', 'D')
but don't do that, it's unreadable to the point of being nonsense
what you have is clear
So my result method that is the 3rd one on that pasteOfCode
Is not ok
if your method does what the fourth block is (minus the spurious copying in the first line), then you don't need to call tuple() again on the return value
13:26
Yaya I know, but I mean that I have not put the new_state = list(state) and then asign this new_state to the result of that method
Sorry, I don't understand.
I have this return return method(state)
instead of
new_state = list(state)
new_state= method(state)
return new_state
I think you're again talking about a version of the code that i can't see
3rd method I did not copy the state
what's the "3rd method"? :P
13:30
pasteOfCode methods
the 3rd one
:P
@holdenweb howdy
methods = {
            self.ACTIONS[0]: self.moveLeft,
            self.ACTIONS[1]: self.moveRight,
            self.ACTIONS[2]: self.jumpLeft,
            self.ACTIONS[3]: self.jumpRight,
        }[action]
        return tuple(methods(state))
that's what I see ^
Yes, and from start I had this :
def result(self, state, action):
methods = {
self.ACTIONS[0]: self.moveLeft(state),
self.ACTIONS[1]: self.moveRight(state),
self.ACTIONS[2]: self.jumpLeft(state),
self.ACTIONS[3]: self.jumpRight(state),
}[action]
new_state = list(state)[methods]
return tuple(new_state)
I do not have the new_state
to return the copy of the current state
new_state = methods(state)
return new_state
now you do ^ :P
I'm probably missing your point
doing this I avoid reference stuff right? return methods(state)
13:36
No/yes. You have a tuple of strings, there's no "reference stuff". Your method already returns a new tuple.
DSM
DSM
Back-in-LCC cabbage for all!
cabbage
DSM
DSM
@JonClements: did someone mention you were cheered by a room of thousands?
@DSM was that the one with pitchforks and torches?
then I'm done I guess
I've understood all
I appreciate your help buddy :)
And your effort
13:38
Awesome :) Don't call me buddy and we're cool :D
good luck, and have fun with python
DSM
DSM
Later that day I joked with a friend that some of the talks seemed designed to have a lot of laugh lines. "It's like they'll put up a picture of a puppy, and then everyone will applaud -- 'Yay, puppies!'" In the very next talk the speaker put up a picture of a puppy, and everyone applauded.
\o fresh cbg on this brand new week
@DSM have you considered the possibility that your statement fundamentally altered reality, thereby making the puppy appear?
@AndrasDeak ok :(
DSM
DSM
O.o I had not, in fact, considered that.
13:40
@Skizo-ozᴉʞS don't take it personally ;)
someone send help, I can't stop listening to The Veldt
jpp
jpp
guys, I've got a pretty basic question (in fact, it's this one). we have a json file with floats, e.g. 'value': 3.8 in the file. I need to read that into Python precisely as 3.8. is that even possible without converting to float? Converting to float will introduce floating point approximations.
decimal?
jpp
jpp
the current solution does something like Decimal(3.8), but this seems like a hack.
Decimal(3.8) is pointless
jpp
jpp
13:48
exactly
Decimal('3.8') might make sense
you need to read it as a string, otherwise you're already done for
jpp
jpp
we need to read in 3.8 as '3.8', then apply Decimal
but all the questions go the other way (how do we read string as float)
none of them tell us how to read 3.8 as '3.8'.
Well you read strings as strings, right?
json specifically might eat those and spit out floats, I'm not closely familiar with it. But reading always happens as strings.
jpp
jpp
json.loads I think reads 3.8 straight to float, I don't know a way to force it to read as string
@AndrasDeak, Yep it seems like there should be an option for this, but I couldn't find it
yup, it's not meant to leave numbers as strings I think
@jpp no, it's not something straightforward you want to do I think
jpp
jpp
13:50
worth offering a bounty on this one? i'll put one up.
unless something something finance
jpp
jpp
but want to avoid someone replying with a one-liner :)
@jpp we should try looking around a bit first, yeah
jpp
jpp
yeh will wait a day or two, will see what I can find
did you look at Decoders in json?
> parse_float, if specified, will be called with the string of every JSON float to be decoded. By default, this is equivalent to float(num_str). This can be used to use another datatype or parser for JSON floats (e.g. decimal.Decimal).
well well well :)
jpp
jpp
13:52
that's exactly what the current solution does
oh...so why is that wrong?
json.loads('{"value":3.8}', parse_float=str)
jpp
jpp
but I'm not sure whether it's just decimal.Decimal(3.8) or decimal.Decimal('3.8')
i'm going to do some testing.
@PM2Ring I have 3.6.4
DSM
DSM
13:54
decimal.Decimal(3.8) wouldn't make sense, you'd be throwing away the precision beforehand.
> I know that I can serialize event back to a string and then instruct the parser to use Decimal
[...]
But that feels like a hack. Is there some way to control the deserialization in the first place so that event prefers Decimal to float?
Just because OP thinks the right solution is a hack doesn't make it a hack. That looks exactly what it's supposed to be used for
it's even there in the yamming documentation :P
jpp
jpp
@DSM, Ha, ok, so much ado about nothing.
thks
import json
from decimal import Decimal

json.loads('{"value":3.8}', parse_float=Decimal)

# {'value': Decimal('3.8')}
@jpp I thought we already had that covered chat.stackoverflow.com/transcript/message/42527082#42527082
I'm starting to lose my grip on your point
The problem is that the input isn't json, no? It's already been parsed to a float. The precision is already gone.
13:56
jpp came here asking about json specifically
@Aran-Fey in that case you can only hack it by f'{value:.1f}'
jpp
jpp
yeh it's definitely json: parsed = json.loads(json.dumps(event), parse_float=Decimal)
I just didn't understand exactly what the parser was doing
it was parsing :)
Not a hack
DSM
DSM
Something I did broke bidirectional copy-pasting with my virtualbox. :-/
it's a hack because you need to guess the precision
@DSM have you tried turning it off and on again?
DSM
DSM
13:58
In [6]: json.loads('{"value":3.8}', parse_float=lambda x: Decimal(float(x)))
Out[6]: {'value': Decimal('3.79999999999999982236431605997495353221893310546875')}
I meant parse_float=Decimal is not a hack.
So event isn't json. json.loads(json.dumps(event)) is just a stupid way to round a float
@piRSquared yes, that's (also) my point
good! We agree then (-:
yup :P
@DSM :|
TIL pyplot {'C0', 'C1', 'C2', 'C3', 'C4', 'C5', 'C6', 'C7', 'C8', 'C9'} and {'tab:blue', 'tab:orange', 'tab:green', 'tab:red', 'tab:purple', 'tab:brown', 'tab:pink', 'tab:gray', 'tab:olive', 'tab:cyan'} names for the default colour cycle
also "a name from the xkcd color survey prefixed with 'xkcd:' (e.g., 'xkcd:sky blue')", awesome
14:02
@JonClements Hi there! Long time ...
@Aran-Fey The problem is that ReST has its own tokenizer, which treats "-" and ">" as discrete tokens. This in turn leaves the renderer free to put the "-" on one line and the ">" on another. It is this behaviour I seek to inhibit.
does ReST eat   by any chance? :)
oops, you need a nbnsp
heh, the first sentence in the ReST specification is already a lie: "reStructuredText is plaintext that uses simple and intuitive constructs"
it's intuitive if you know ReST
@holdenweb indeed... new place going okay?
Not bad, thanks. Into user testing, about to onboard our fist live Australian customers this week, and planning to do some load testing on our backend to make sure we are ready to scale.
What's your current gig?
14:15
@holdenweb You can try to escape those characters with a backslash or double backticks like ``>``
morning cabbage
14:31
@holdenweb doing a bit for a few places - one telecomms, one finance and one marketing... confusing morning when I reach my desk
Nice one
what hasn't already can be paid forward at least... but mostly a confusing day :p
jpp
jpp
What do we do with historic (canonical?) Q&A where the question is just misinterpreted, i.e. the answers just respond to the title. This is the one. It seems the 100+ UV answer doesn't actually answer the question.
Well, to be fair, there is an edit to the answer, but it's poor (list.index "doesn't iterate").
I added an answer myself, but not sure whether it's better or worse.. will delete it if you guys think it's worse.
cbg
performance question :)
wb
14:46
my_string in list
is this very slow?
cause I'm iterating 14M of elements in a list, and checking if the string exists in a 6k-element list
with this: [i for i,x in enumerate(synsets) if x in human_synsets]
shouldn't be slow for what it is
and it's taking forever :D
(I just want to get the indices)
both are string lists
x in list should be pretty easy to optimise I'd imagine
DSM
DSM
Make a set from human_synsets. Membership tests in sets are much faster than in lists.
jpp
jpp
why would anyone do other_list.remove(other_list[index]), isn't this just del other_list[index] except less clear since you remove the wrong item if you have a duplicate?
14:48
Ah, good point, @DSM
ok, I'll try
cabbage all
@jpp the answer is "because they're n00bs"
jpp
jpp
@Aran-Fey, But this answer has +100 !
That's also because of n00bs :)
jpp
jpp
14:50
I feel like editing, but I'm afraid someone will tell me off for changing an answer.
drive-by upvotes from people who know nothing about python and found the answer on google
@jpp provide your own answer. suffer the indignation of having less votes than an inferior answer and move on
I don't think anyone would mind. I'll make that edit for you.
Is "made the code less terrible" an acceptable summary for such an edit?
jpp
jpp
@Aran-Fey, Yeh - please do. It's especially important if it's got google behind it.
It's only acceptable if the community accepts it (-: I'm curious if you can petition it to be community wiki'd
jpp
jpp
14:53
@piRSquared, Yeh it's not about the votes here. More about being just a bad answer.
I get you (-:
@jpp I was always under the impression that del list[index] didn't adjust the list indices
or am I thinking of like, JS
what am I thinking that wouldn't be pythonic xD
jpp
jpp
I think del lst[index] is the only solution. The indices realign in your new list. So lst[len(lst)-1] will be the last element.
wait
in your new list..?
jpp
jpp
In any list, at any one point in time, I believe
14:59
okay good
I thought you were implying that lists behaved immutably like strings
which would just be weird
yeah I was thinking JS' delete xD
Set doesn't help :/
I hate when clients reps at our company asks us to come up a way to use a hammer to screw screws in rather using the screwdriver we provided..
DSM
DSM
@Neoares: pretty sure it would. What did you actually do?
also why do you have 14 million items in a list? Are you planning (or is there potential) on using it all? Is there no way of you filtering the data upstream to a smaller set of items that you will for sure use ?
@DSM hahaha wait
I did hs = set(human_synset)
then used human_synset instead of hs
using the actual set did it in 1-2 seconds lol
this is awesome
@MooingRawr I want to filter images from imagenet to get only the ones related to humans
since my neural network is super biased now
15:11
for reasons that shall not be detailed here :P
Continuing my pointless adventure from Friday, I've implemented a call stack in subleq. I need it if I want to print integers that have more than one digit.
@AndrasDeak exactly
Or, rather, I could print integers with more than one digit before, but only in reverse order.
time to read back Friday's transcript.
I'm trying to implement "99 bottles of beer". I guess it's not strictly necessary to allow the printing of arbitrarily large numbers, since I should only need two digits. But it's the principle of the thing.
15:13
hehe
15:43
Just spent fifteen minutes trying to figure out why my loop wasn't ending... ten = 0 probably has something to do with it
off-by-one?
DSM
DSM
:-P
jpp
jpp
stackoverflow.com/questions/50293689/… - Poor OP lost for 3 days wondering why nobody's answered. Closing may be the only escape route.
Very glad that the problem wasn't in my ret or call logic, because I wrote them with 60% of my maximum cleverness, and debugging is twice as hard as writing, so...
Anyway, it's working now. It takes a mere 55,0513 CPU cycles to print "1234567"
On account of my A%B modulus implementation being O(A//B)
DSM
DSM
@jpp: under the circumstances I think it's pretty clear it's by index and column, and I'm sure we've got a dup for df.lookup(df.index, s) or something similar floating around.
15:51
@Kevin that's why you don't number your variables!
subleq++ doesn't support integer literals yet, so absolutely every number I use has to have a name
jpp
jpp
@DSM, Sure, nothing seems clear to me. Feel free to dup it.
@PM2Ring IIRC, the Self documentation explains that Smalltalk is only dynamically typed accidentally, because it's dynamically-everything-ed, and that's the real benefit. You could make the same argument for Python, although maybe only since PEP 562 made dynamic module attribute lookup as reasonable as dynamic class/instance attribute lookup.
@jpp It's not just less clear and less correct, it also takes longer (both linear, but del from the middle has average-case N/2 and best-case 1, while remove has average-case and best-case N), so it's a win in every dimension.
jpp
jpp
@abarnert Yup, definitely O(n) which is why the comment "you don't need to iterate" just seemed wrong.
Mutating a list is usually O(n). I love when people say "I want to do this in-place instead of using a comprehension so it'll be faster", and no matter how much you try to explain that it'll actually be slower once they manage to get it right, they still insist they want to do it that way.
4
16:06
hey guys, have you guys had any experience with pyinstaller not able to properly install matplotlib?
But... the in-place operation is faster, because it doesn't have to re-create the entire list. A list comprehension is O(n); del my_list[i] is O(n-i)
It seems like I always get a ImportError: No module named PyQt4, even though I set PyQtAgg to 5
If you're deleting one element, it's n-1 vs. n. If you're deleting two elements, it's (n-1) + (n-2) vs. n. If you're deleting O(n) elements, it's O(n**2) vs. n. Plus, you usually have to search for the elements you want to delete or iterate the elements to decide which ones to delete, so either way n is the best you can do.
that's true
Of course if you don't care about order, you can always do the lst[n] = lst[-1]; lst.pop() to do each delete in O(1) time, and without breaking your iteration (as long as you're using a while i < len(lst) loop), so then it's only slower by a constant factor… but then if you don't care about order, there's a good chance you didn't want a list in the first place; just use a set or Counter and set-difference it.
16:13
@OneRaynyDay is that on install or run? In the latter case are you choosing a backend?
@AndrasDeak I am not choosing a backend, but I thought in the matplotlibrc it would choose pyqt5 for me
Well try doing that manually first
in my pyinstaller directory, I can clearly see PyQt5 but not PyQt4. I guess doing something like matplotlib.use('PyQt5') would work instead?
If it works, work out the rc
deal. Let me manually set the backend to Tk real quick just to test
16:17
@OneRaynyDay I think so, but I don't know pyinstaller
ah. I'm running it in a pretty sterile gcloud instance with barely any packages installed :P
so a lot of package hell problems come up. Pyinstaller isn't as magical as I originally thought it was
@OneRaynyDay why not set it to pyqt5?
Just cause previously I set my backend to tk and stuff worked, but it was for a completely different issue. I also see tk in my pyinstaller dist directory so I figured choose the safest initial route
Hmm, there's no builtin "split on whitespace except for whitespace inside of a pair of quote marks" function, is there?
Depends. "inside a pair of quote marks" is always a rabbit hole because there's usually a way to escape the quote marks and then there's a way to escape the escape character, and it all gets messy real quick. But something like shlex.split might work for you
16:28
Gesundheit
cabbage all
cbg wayne
@Kevin no, but a fun combination of partition and rpartition would get you there
by fun I mean gross.
@Kevin Alternatively, there's also the csv module
shlex.split isn't quite what I want because I'd prefer 'a "b" c' to get split into ['a', '"b"', 'c'] rather than ['a', 'b', 'c']
16:32
mmm... yeah, that's kind of gnarly in general I guess
nvm then. Regex it is
@Kevin is this an XY problem, or do you really just want the general case?
For the time being I'm going with my sad little handwritten one, which doesn't support escaped characters or anything, but I don't immediately need that anyway
Alternatively...
text = 'a "b" c'

fileobj = StringIO(text.replace('"', '"""'))
reader = csv.reader(fileobj, delimiter=' ')
print(next(reader))
Perhaps I should zoom out and show the complete context of the problem. I'm writing a parser for the "subleq++" language that I'm making up as I go. A syntactically valid subleq++ program is a whitespace-separated collection of integers and identifiers (i.e. something that would be a legal Python variable name). I tokenize the program by calling split() on the raw program data.
But I want to add string literals to the syntax, and string literals might contain spaces, so I can't just call regular split() on the data any more.
So 1 foo "bar" would become a syntactically valid subleq++ program. But if I use shlex.split, then the token stream looks like `['1', 'foo', 'bar'], and I can no longer tell which tokens are identifiers and which are string literals
At some point I should probably write an actual parser, but it seemed like overkill up to this point since I only have two kinds of symbols.
16:44
lazy solution: spaces in string literals have to be substituted with non-breaking spaces
hammer away
17:19
@Aran-Fey I was going to suggest null bytes just to mess with C people
actual null bytes or a representation like \0?
It's surely an excessively premature optimisation, but I'm curious: is abs(a) > max_value or abs(b) > max_value or abs(c) > max_valuegoing to be less efficient than max(abs(a), abs(b), abs(c))>=max_value?
Also, which is more readable?
You could always use tokenize and then raise on any token that isn't STRING, NAME, or NUMBER.
@toonarmycaptain Why not test it instead of asking people to guess?
@toonarmycaptain They're fairly similar in regards to readability IMO, and I haven't the slightest idea which one's faster.
DSM
DSM
In the first one, best case we only call abs once and do one comparison. In the latter we're definitely calling abs three times and we have to make at least three (which is probably exactly three, come to think of it.)
17:28
From a quick %timeit on my laptop, the max version is consistently 190ns, while the or ranges from 95ns to 283ns depending on short-circuiting.
@Aran-Fey actual, of course
In other words, it's faster if the first one already passes, but slower if all of them fail.
@AndrasDeak That's evil. I don't think you can copy/paste a null-byte, can you?
I have no idea :D
you can copy-paste other non-printables, so there's a chance
not in my terminal though
So, do you care about best case, or worst case? Or, if you care about average case, it depends on the expected distribution of your values.
17:30
@abarnert Hmm, interesting that it's consistent. I'm finding max faster, but I expected the max would be less efficient.
Why is it surprising that max is consistent? It always has to do the same amount of work no matter what the values are, while the or version has to do anywhere from 1 to 3 comparisons depending on what the values are.
@abarnert The truth is I don't really care aside from readability right now, as this func isn't likely to be a bottleneck. That said, I'm doing several tests (which won't all run unless none fail) on some data, so taking the abs early and assigning the value might be better on that count.
just make sure that you're consistent about > vs >= ;)
@abarnert I don't know, I figured it would be faster and slower slightly depending on what was passed to it, eg negatives, large numbers
@AndrasDeak Noted :)
has anyone suggested any(abs(k) > max_value for k in (a,b,c))?
17:35
Well, yeah, I didn't test with, say, integers that don't fit in 30 bits and have all but the last few bits the same, which will make each > slower.
probably between the two: generator overhead but short-circuits
@AndrasDeak Surely that would be much slower for n=3…
hmm, though I guess the overhead is a lot in this case, comparatively speaking
Yep. 571ns when it short-circuits, 742ns when it doesn't. The added overhead of the generator swaps everything else, especially for tiny n.
thanks
17:37
My use case here is random generating linear and polynomial equations, but allowing config to keep the potential fraction complexity controlled.
If I just set a to 10**10000, the time difference isn't measurable. But if I set them all to 10**10000 +/- 1, then it adds 1.4us… so yeah, if you have huge ints, then max isn't consistent anymore.
Here's a fun one: if you already have a,b,c in a tuple, max(abc) is about 20ns faster than max(a,b,c) (but if you don't already have a tuple, it costs about 45ns to create one, so it's not worth it).
I tried testing in PyPy, but it's hard to come up with a good way to benchmark it where the JIT doesn't just optimize both versions to False after the first few runs. I guess I can randomly generate the values between each run, then subtract out the cost of that random generating?
@abarnert I could do that...but not worth it. I guess I expected max to have more optimisation somehow, algorithmic-ly or through C-code under the hood.
@abarnert Thankyou, but no worries. Part of my asking offhand in here is that I expected there would be reasoning-wisdom that outweighed cold numbers I could generate myself, then question, then generate more of :)
Well, the fact that it takes only about 67% of the time in the worst case (when there's no short-circuiting) despite doing one extra comparison is presumably because of that C code under the hood. But there's not all that much work to optimize out here, so I wouldn't expect it to be too much better than that.
PyPy continues to amaze me. I tried to throw random values at each loop and then subtract out the cost for randomizing, but I forgot to include negative numbers in the range, and it appears to have optimized out the calls to abs. Anyway, it It takes 41ns for max, 27ns to 50ns for or (depending on short-circuiting again).
18:00
@abarnert That's pretty cool of PyPy.
What would the theme song accompanying a superhero called snakeman sound like? pypypypypypypypypypypy snakeman!
(...I'll show myself out)
@cᴏʟᴅsᴘᴇᴇᴅ Hissssssssssssssss snakeman?
meh not much of a theme song there
user9313040
18:29
hello guys
user9313040
Can I write a program that sees in how many ways , we can write the integer n as the sum of two or more integers without recursive function?
@BornaAhmadzade return math.inf would be a pretty short function, and not recursive…
0
Q: Django: Load production settings for celery

CodyMy Django project has multiple settings file for development, production and testing. And I am using supervisor to manage the celery worker. My question how to load the settings file for celery based on the environment I am in.

@cᴏʟᴅsᴘᴇᴇᴅ With enough autotune, I'm pretty sure @toonarmycaptain could make it a catchy theme song.
user9313040
18:34
Thank you so much!!!
anyone know how to load the correct settings file in production for celery
@Cody See the rules:
Don't ask for answers to your recent Stack Overflow questions. Those who can answer are already watching the queue on the main site.
If your question is eligible for a bounty (>= 48 hours old) and hasn't received a useful response, then you may link to it.
DSM
DSM
@abarnert: that may have backfired.
@abarnert The world would never have seen so much autotune...
user7496931
Hey guys
18:37
hello
user7496931
New Python user here
welcome :)
user7496931
Thanks!
user7496931
Trying to install Miniconda with .zsh and running into some issues
Please read abarnert's last messages ^
user7496931
18:37
Ah ok
user7496931
Noted, thanks anyway!
thanks, you're welcome to ask then if the problem is still unsolved :)
user7496931
Sounds good
user7496931
First time using a chat here!
Chat is good to have but formatting has its quirks...
18:39
sorry
it's OK
DSM
DSM
@user7496931: I'll ask a question here to avoid cluttering your question -- where did you install miniconda?

« first day (2767 days earlier)      last day (2406 days later) »